@univerjs/design 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
Files changed (88) hide show
  1. package/lib/cjs/index.js +126 -109
  2. package/lib/cjs/locale/ar-SA.js +11 -1
  3. package/lib/cjs/locale/ca-ES.js +11 -1
  4. package/lib/cjs/locale/de-DE.js +11 -1
  5. package/lib/cjs/locale/en-US.js +10 -0
  6. package/lib/cjs/locale/es-ES.js +20 -10
  7. package/lib/cjs/locale/fa-IR.js +11 -1
  8. package/lib/cjs/locale/fr-FR.js +11 -1
  9. package/lib/cjs/locale/id-ID.js +11 -1
  10. package/lib/cjs/locale/it-IT.js +11 -1
  11. package/lib/cjs/locale/ja-JP.js +11 -1
  12. package/lib/cjs/locale/ko-KR.js +11 -1
  13. package/lib/cjs/locale/pl-PL.js +11 -1
  14. package/lib/cjs/locale/pt-BR.js +11 -1
  15. package/lib/cjs/locale/ru-RU.js +11 -1
  16. package/lib/cjs/locale/sk-SK.js +11 -1
  17. package/lib/cjs/locale/vi-VN.js +11 -1
  18. package/lib/cjs/locale/zh-CN.js +10 -0
  19. package/lib/cjs/locale/zh-HK.js +10 -0
  20. package/lib/cjs/locale/zh-TW.js +10 -0
  21. package/lib/es/index.js +127 -111
  22. package/lib/es/locale/ar-SA.js +11 -1
  23. package/lib/es/locale/ca-ES.js +11 -1
  24. package/lib/es/locale/de-DE.js +11 -1
  25. package/lib/es/locale/en-US.js +10 -0
  26. package/lib/es/locale/es-ES.js +20 -10
  27. package/lib/es/locale/fa-IR.js +11 -1
  28. package/lib/es/locale/fr-FR.js +11 -1
  29. package/lib/es/locale/id-ID.js +11 -1
  30. package/lib/es/locale/it-IT.js +11 -1
  31. package/lib/es/locale/ja-JP.js +11 -1
  32. package/lib/es/locale/ko-KR.js +11 -1
  33. package/lib/es/locale/pl-PL.js +11 -1
  34. package/lib/es/locale/pt-BR.js +11 -1
  35. package/lib/es/locale/ru-RU.js +11 -1
  36. package/lib/es/locale/sk-SK.js +11 -1
  37. package/lib/es/locale/vi-VN.js +11 -1
  38. package/lib/es/locale/zh-CN.js +10 -0
  39. package/lib/es/locale/zh-HK.js +10 -0
  40. package/lib/es/locale/zh-TW.js +10 -0
  41. package/lib/index.css +44 -0
  42. package/lib/index.js +127 -111
  43. package/lib/locale/ar-SA.js +11 -1
  44. package/lib/locale/ca-ES.js +11 -1
  45. package/lib/locale/de-DE.js +11 -1
  46. package/lib/locale/en-US.js +10 -0
  47. package/lib/locale/es-ES.js +20 -10
  48. package/lib/locale/fa-IR.js +11 -1
  49. package/lib/locale/fr-FR.js +11 -1
  50. package/lib/locale/id-ID.js +11 -1
  51. package/lib/locale/it-IT.js +11 -1
  52. package/lib/locale/ja-JP.js +11 -1
  53. package/lib/locale/ko-KR.js +11 -1
  54. package/lib/locale/pl-PL.js +11 -1
  55. package/lib/locale/pt-BR.js +11 -1
  56. package/lib/locale/ru-RU.js +11 -1
  57. package/lib/locale/sk-SK.js +11 -1
  58. package/lib/locale/vi-VN.js +11 -1
  59. package/lib/locale/zh-CN.js +10 -0
  60. package/lib/locale/zh-HK.js +10 -0
  61. package/lib/locale/zh-TW.js +10 -0
  62. package/lib/types/components/accordion/Accordion.d.ts +4 -0
  63. package/lib/types/components/button/Button.d.ts +1 -1
  64. package/lib/types/components/message/Message.d.ts +2 -2
  65. package/lib/types/components/segmented/Segmented.d.ts +2 -1
  66. package/lib/types/index.d.ts +1 -1
  67. package/lib/types/locale/en-US.d.ts +10 -0
  68. package/lib/umd/index.js +14 -14
  69. package/lib/umd/locale/ar-SA.js +1 -1
  70. package/lib/umd/locale/ca-ES.js +1 -1
  71. package/lib/umd/locale/de-DE.js +1 -1
  72. package/lib/umd/locale/en-US.js +1 -1
  73. package/lib/umd/locale/es-ES.js +1 -1
  74. package/lib/umd/locale/fa-IR.js +1 -1
  75. package/lib/umd/locale/fr-FR.js +1 -1
  76. package/lib/umd/locale/id-ID.js +1 -1
  77. package/lib/umd/locale/it-IT.js +1 -1
  78. package/lib/umd/locale/ja-JP.js +1 -1
  79. package/lib/umd/locale/ko-KR.js +1 -1
  80. package/lib/umd/locale/pl-PL.js +1 -1
  81. package/lib/umd/locale/pt-BR.js +1 -1
  82. package/lib/umd/locale/ru-RU.js +1 -1
  83. package/lib/umd/locale/sk-SK.js +1 -1
  84. package/lib/umd/locale/vi-VN.js +1 -1
  85. package/lib/umd/locale/zh-CN.js +1 -1
  86. package/lib/umd/locale/zh-HK.js +1 -1
  87. package/lib/umd/locale/zh-TW.js +1 -1
  88. package/package.json +9 -9
package/lib/es/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, DropdownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
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 { twMerge } from "tailwind-merge";
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
- import { Slot } from "@radix-ui/react-slot";
8
7
  import { DirectionProvider } from "@radix-ui/react-direction";
8
+ import { Slot } from "@radix-ui/react-slot";
9
9
  import { CheckboxItem, Content, Item, ItemIndicator, Portal, RadioGroup as RadioGroup$1, RadioItem, Root, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-dropdown-menu";
10
10
  import { Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
11
11
  import { Close, Content as Content$2, Description, Overlay, Portal as Portal$2, Root as Root$2, Title } from "@radix-ui/react-dialog";
@@ -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
- const { className, items } = props;
28
- const [openIndex, setOpenIndex] = useState(null);
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
- setOpenIndex(openIndex === index ? null : index);
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) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
36
- 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",
37
- type: "button",
38
- onClick: () => toggleItem(index),
39
- children: [/* @__PURE__ */ jsx(DownIcon, { className: clsx("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
40
- "-univer-rotate-90": openIndex !== index,
41
- "univer-rotate-0": openIndex === index
42
- }) }), /* @__PURE__ */ jsx("span", {
43
- className: "univer-font-medium",
44
- children: item.label
45
- })]
46
- }), /* @__PURE__ */ jsx("div", {
47
- className: clsx("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
48
- "univer-max-h-screen": openIndex === index,
49
- "univer-max-h-0": openIndex !== index
50
- }),
51
- children: /* @__PURE__ */ jsx("div", {
52
- className: "univer-box-border univer-px-4 univer-py-1.5",
53
- children: item.children
54
- })
55
- })] }, index))
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
 
@@ -110,10 +118,57 @@ function Avatar(props) {
110
118
  });
111
119
  }
112
120
 
121
+ //#endregion
122
+ //#region src/helper/is-browser.ts
123
+ /**
124
+ * Copyright 2023-present DreamNum Co., Ltd.
125
+ *
126
+ * Licensed under the Apache License, Version 2.0 (the "License");
127
+ * you may not use this file except in compliance with the License.
128
+ * You may obtain a copy of the License at
129
+ *
130
+ * http://www.apache.org/licenses/LICENSE-2.0
131
+ *
132
+ * Unless required by applicable law or agreed to in writing, software
133
+ * distributed under the License is distributed on an "AS IS" BASIS,
134
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135
+ * See the License for the specific language governing permissions and
136
+ * limitations under the License.
137
+ */
138
+ function isBrowser() {
139
+ return typeof window !== "undefined" && typeof document !== "undefined";
140
+ }
141
+
142
+ //#endregion
143
+ //#region src/components/config-provider/ConfigProvider.tsx
144
+ const ConfigContext = createContext({ mountContainer: isBrowser() ? document.body : null });
145
+ function ConfigProvider(props) {
146
+ const { children, locale, mountContainer, direction } = props;
147
+ const value = useMemo(() => {
148
+ return {
149
+ locale,
150
+ direction,
151
+ mountContainer
152
+ };
153
+ }, [
154
+ locale,
155
+ direction,
156
+ mountContainer
157
+ ]);
158
+ return /* @__PURE__ */ jsx(ConfigContext.Provider, {
159
+ value,
160
+ children: /* @__PURE__ */ jsx(DirectionProvider, {
161
+ dir: direction !== null && direction !== void 0 ? direction : "ltr",
162
+ children
163
+ })
164
+ });
165
+ }
166
+
113
167
  //#endregion
114
168
  //#region src/components/badge/Badge.tsx
115
169
  function Badge(props) {
116
170
  const { className, children, closable = false, onClose } = props;
171
+ const { locale } = useContext(ConfigContext);
117
172
  return /* @__PURE__ */ jsxs("span", {
118
173
  "data-u-comp": "badge",
119
174
  className: clsx("univer-box-border univer-inline-flex univer-items-center univer-gap-1 univer-truncate univer-rounded-md univer-border univer-border-solid univer-border-gray-100 univer-bg-gray-100 univer-px-2.5 univer-py-0.5 univer-text-xs univer-font-medium univer-text-gray-900 dark:!univer-border-gray-500 dark:!univer-bg-gray-700 dark:!univer-text-gray-300", className),
@@ -123,7 +178,7 @@ function Badge(props) {
123
178
  }), closable && /* @__PURE__ */ jsx("button", {
124
179
  className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-p-0 univer-outline-none univer-transition-opacity hover:univer-opacity-70",
125
180
  type: "button",
126
- "aria-label": "Close badge",
181
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.closeBadge,
127
182
  onClick: onClose,
128
183
  children: /* @__PURE__ */ jsx(CloseIcon, { className: "univer-text-current" })
129
184
  })]
@@ -143,6 +198,7 @@ const buttonVariants = cva$1("univer-box-border univer-inline-flex univer-cursor
143
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-white dark:hover:!univer-bg-gray-700 dark:active:!univer-bg-gray-600"
144
199
  },
145
200
  size: {
201
+ icon: "univer-size-8 !univer-p-0",
146
202
  small: "univer-h-6 univer-rounded-md univer-px-1.5 univer-text-xs",
147
203
  middle: "univer-h-8 univer-rounded-lg univer-px-2 univer-text-sm",
148
204
  large: "univer-h-10 univer-rounded-lg univer-px-3 univer-text-sm"
@@ -167,52 +223,6 @@ const Button = forwardRef(({ className, variant, size, asChild = false, ...props
167
223
  });
168
224
  Button.displayName = "Button";
169
225
 
170
- //#endregion
171
- //#region src/helper/is-browser.ts
172
- /**
173
- * Copyright 2023-present DreamNum Co., Ltd.
174
- *
175
- * Licensed under the Apache License, Version 2.0 (the "License");
176
- * you may not use this file except in compliance with the License.
177
- * You may obtain a copy of the License at
178
- *
179
- * http://www.apache.org/licenses/LICENSE-2.0
180
- *
181
- * Unless required by applicable law or agreed to in writing, software
182
- * distributed under the License is distributed on an "AS IS" BASIS,
183
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184
- * See the License for the specific language governing permissions and
185
- * limitations under the License.
186
- */
187
- function isBrowser() {
188
- return typeof window !== "undefined" && typeof document !== "undefined";
189
- }
190
-
191
- //#endregion
192
- //#region src/components/config-provider/ConfigProvider.tsx
193
- const ConfigContext = createContext({ mountContainer: isBrowser() ? document.body : null });
194
- function ConfigProvider(props) {
195
- const { children, locale, mountContainer, direction } = props;
196
- const value = useMemo(() => {
197
- return {
198
- locale,
199
- direction,
200
- mountContainer
201
- };
202
- }, [
203
- locale,
204
- direction,
205
- mountContainer
206
- ]);
207
- return /* @__PURE__ */ jsx(ConfigContext.Provider, {
208
- value,
209
- children: /* @__PURE__ */ jsx(DirectionProvider, {
210
- dir: direction !== null && direction !== void 0 ? direction : "ltr",
211
- children
212
- })
213
- });
214
- }
215
-
216
226
  //#endregion
217
227
  //#region src/components/button/ButtonGroup.tsx
218
228
  const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
@@ -646,7 +656,7 @@ function DayButton(props) {
646
656
  }
647
657
  function Calendar(props) {
648
658
  const { className, max, min, showTime = false, value, onValueChange } = props;
649
- const { locale } = useContext(ConfigContext);
659
+ const { direction = "ltr", locale } = useContext(ConfigContext);
650
660
  const { ariaLabels, year, weekDays, months } = locale === null || locale === void 0 ? void 0 : locale.Calendar;
651
661
  const today = /* @__PURE__ */ new Date();
652
662
  const [currentYear, setCurrentYear] = useState((value !== null && value !== void 0 ? value : today).getFullYear());
@@ -742,6 +752,7 @@ function Calendar(props) {
742
752
  }
743
753
  return /* @__PURE__ */ jsxs("div", {
744
754
  "data-u-comp": "calendar",
755
+ dir: direction,
745
756
  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),
746
757
  children: [
747
758
  /* @__PURE__ */ jsxs("nav", {
@@ -751,7 +762,7 @@ function Calendar(props) {
751
762
  className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
752
763
  "aria-label": ariaLabels.previousMonth,
753
764
  onClick: prevMonth,
754
- children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "univer-rotate-180" })
765
+ children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "univer-rotate-180 rtl:!univer-rotate-0" })
755
766
  }),
756
767
  /* @__PURE__ */ jsxs("span", {
757
768
  className: "univer-flex univer-items-center univer-gap-0.5 univer-text-sm univer-font-medium",
@@ -796,7 +807,7 @@ function Calendar(props) {
796
807
  className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
797
808
  "aria-label": ariaLabels.nextMonth,
798
809
  onClick: nextMonth,
799
- children: /* @__PURE__ */ jsx(MoreRightIcon, {})
810
+ children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "rtl:univer-rotate-180" })
800
811
  })
801
812
  ]
802
813
  }),
@@ -1142,7 +1153,6 @@ function useDraggable(options = {}) {
1142
1153
  };
1143
1154
  }
1144
1155
  function Dialog(props) {
1145
- var _locale$Confirm$cance, _locale$Confirm, _locale$Confirm$confi, _locale$Confirm2;
1146
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;
1147
1157
  const { locale, mountContainer, direction } = useContext(ConfigContext);
1148
1158
  const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
@@ -1153,11 +1163,11 @@ function Dialog(props) {
1153
1163
  className: "univer-flex univer-justify-end univer-gap-2",
1154
1164
  children: [showCancel && /* @__PURE__ */ jsx(Button, {
1155
1165
  onClick: onCancel,
1156
- children: (_locale$Confirm$cance = locale === null || locale === void 0 || (_locale$Confirm = locale.Confirm) === null || _locale$Confirm === void 0 ? void 0 : _locale$Confirm.cancel) !== null && _locale$Confirm$cance !== void 0 ? _locale$Confirm$cance : "Cancel"
1166
+ children: locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel
1157
1167
  }), showOk && /* @__PURE__ */ jsx(Button, {
1158
1168
  variant: "primary",
1159
1169
  onClick: onOk,
1160
- children: (_locale$Confirm$confi = locale === null || locale === void 0 || (_locale$Confirm2 = locale.Confirm) === null || _locale$Confirm2 === void 0 ? void 0 : _locale$Confirm2.confirm) !== null && _locale$Confirm$confi !== void 0 ? _locale$Confirm$confi : "OK"
1170
+ children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
1161
1171
  })]
1162
1172
  }) : null;
1163
1173
  const handleContentRef = useCallback((node) => {
@@ -1904,7 +1914,6 @@ const MemoizedAlphaSlider = memo(AlphaSlider);
1904
1914
  const MemoizedColorInput = memo(ColorInput);
1905
1915
  const MemoizedColorPresets = memo(ColorPresets);
1906
1916
  function ColorPicker({ format = "hex", value, onChange }) {
1907
- if (!isBrowser) return null;
1908
1917
  const { direction, locale } = useContext(ConfigContext);
1909
1918
  const [hsv, setHsv] = useState([
1910
1919
  0,
@@ -1941,6 +1950,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
1941
1950
  console.error("Invalid value:", error);
1942
1951
  }
1943
1952
  }, [value, format]);
1953
+ if (!isBrowser) return null;
1944
1954
  function handleColorChange(h, s, v) {
1945
1955
  setHsv([
1946
1956
  h,
@@ -2429,11 +2439,7 @@ const FormDualColumnLayout = (props) => {
2429
2439
  */
2430
2440
  function Pager(props) {
2431
2441
  const { className, value: current = 0, total: count = 0, loop, text: propText, onChange } = props;
2432
- const text = useMemo(() => propText !== null && propText !== void 0 ? propText : `${current}/${count}`, [
2433
- current,
2434
- count,
2435
- propText
2436
- ]);
2442
+ const text = propText !== null && propText !== void 0 ? propText : `${current}/${count}`;
2437
2443
  const hasValue = count > 0;
2438
2444
  const onClickLeftArrow = () => {
2439
2445
  if (current === 1) {
@@ -2451,11 +2457,11 @@ function Pager(props) {
2451
2457
  children: hasValue ? /* @__PURE__ */ jsxs(Fragment, { children: [
2452
2458
  /* @__PURE__ */ jsx("button", {
2453
2459
  "data-u-comp": "pager-left-arrow",
2454
- 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",
2460
+ 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",
2455
2461
  type: "button",
2456
2462
  role: "button",
2457
2463
  onClick: onClickLeftArrow,
2458
- children: /* @__PURE__ */ jsx(MoreLeftIcon, {})
2464
+ children: /* @__PURE__ */ jsx(MoreLeftIcon, { className: "rtl:univer-rotate-180" })
2459
2465
  }),
2460
2466
  /* @__PURE__ */ jsx("span", {
2461
2467
  className: "univer-mx-1",
@@ -2463,11 +2469,11 @@ function Pager(props) {
2463
2469
  }),
2464
2470
  /* @__PURE__ */ jsx("button", {
2465
2471
  "data-u-comp": "pager-right-arrow",
2466
- 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",
2472
+ 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",
2467
2473
  type: "button",
2468
2474
  role: "button",
2469
2475
  onClick: onClickRightArrow,
2470
- children: /* @__PURE__ */ jsx(MoreRightIcon, {})
2476
+ children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "rtl:univer-rotate-180" })
2471
2477
  })
2472
2478
  ] }) : /* @__PURE__ */ jsx("div", {
2473
2479
  className: "univer-mx-1",
@@ -2503,9 +2509,10 @@ function Gallery(props) {
2503
2509
  const [isVisible, setIsVisible] = useState(false);
2504
2510
  const [activeImageIndex, setActiveImageIndex] = useState(0);
2505
2511
  const [zoomLevel, setZoomLevel] = useState(1);
2506
- const { direction } = useContext(ConfigContext);
2512
+ const { direction, locale } = useContext(ConfigContext);
2507
2513
  const dialogRef = useRef(null);
2508
- const activeImage = useMemo(() => images[activeImageIndex], [activeImageIndex, images]);
2514
+ const activeImage = images[activeImageIndex];
2515
+ const hasPagination = images.length > 1;
2509
2516
  useEffect(() => {
2510
2517
  if (open && dialogRef.current) dialogRef.current.focus();
2511
2518
  }, [open]);
@@ -2554,7 +2561,7 @@ function Gallery(props) {
2554
2561
  dir: direction,
2555
2562
  role: "dialog",
2556
2563
  "aria-modal": "true",
2557
- "aria-label": "Image gallery",
2564
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.imageGallery,
2558
2565
  tabIndex: -1,
2559
2566
  ref: dialogRef,
2560
2567
  className: clsx("univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-h-screen univer-w-screen univer-select-none univer-items-center univer-justify-center", {
@@ -2573,14 +2580,14 @@ function Gallery(props) {
2573
2580
  className: "univer-h-full univer-w-full univer-object-contain univer-transition-transform univer-duration-300 univer-ease-out",
2574
2581
  style: { transform: `scale(${zoomLevel})` },
2575
2582
  src: activeImage,
2576
- alt: `Image ${activeImageIndex + 1} of ${images.length}`,
2583
+ alt: locale === null || locale === void 0 ? void 0 : locale.Accessibility.image.replace("{0}", String(activeImageIndex + 1)).replace("{1}", String(images.length)),
2577
2584
  draggable: false
2578
2585
  })
2579
2586
  }),
2580
2587
  /* @__PURE__ */ jsxs("footer", {
2581
2588
  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",
2582
2589
  children: [
2583
- /* @__PURE__ */ jsx(Pager, {
2590
+ hasPagination && /* @__PURE__ */ jsx(Pager, {
2584
2591
  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",
2585
2592
  value: activeImageIndex + 1,
2586
2593
  total: images.length,
@@ -2588,21 +2595,21 @@ function Gallery(props) {
2588
2595
  }),
2589
2596
  /* @__PURE__ */ jsx("button", {
2590
2597
  type: "button",
2591
- "aria-label": "Zoom in",
2598
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.zoomIn,
2592
2599
  className: buttonClassName,
2593
2600
  onClick: () => handleToggleZoom(.25),
2594
2601
  children: /* @__PURE__ */ jsx(ZoomInIcon, { "aria-hidden": "true" })
2595
2602
  }),
2596
2603
  /* @__PURE__ */ jsx("button", {
2597
2604
  type: "button",
2598
- "aria-label": "Zoom out",
2605
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.zoomOut,
2599
2606
  className: buttonClassName,
2600
2607
  onClick: () => handleToggleZoom(-.25),
2601
2608
  children: /* @__PURE__ */ jsx(ZoomOutIcon, { "aria-hidden": "true" })
2602
2609
  }),
2603
2610
  /* @__PURE__ */ jsx("button", {
2604
2611
  type: "button",
2605
- "aria-label": "Reset zoom",
2612
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.resetZoom,
2606
2613
  className: buttonClassName,
2607
2614
  onClick: () => handleToggleZoom("reset"),
2608
2615
  children: /* @__PURE__ */ jsx(OneToOneIcon, { "aria-hidden": "true" })
@@ -2660,7 +2667,10 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
2660
2667
  useEffect(() => {
2661
2668
  if (allowClear && !(slot && slotRef.current)) setPaddingRight(26);
2662
2669
  }, []);
2663
- const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : {
2670
+ const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : direction === "rtl" ? {
2671
+ ...inputStyle,
2672
+ paddingLeft: paddingRight
2673
+ } : {
2664
2674
  ...inputStyle,
2665
2675
  paddingRight
2666
2676
  };
@@ -2671,7 +2681,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
2671
2681
  children: [/* @__PURE__ */ jsx("input", {
2672
2682
  ref,
2673
2683
  type,
2674
- 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),
2684
+ 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),
2675
2685
  placeholder,
2676
2686
  value,
2677
2687
  disabled,
@@ -2684,7 +2694,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
2684
2694
  style: mergedInputStyle,
2685
2695
  ...props
2686
2696
  }), hasSlotContent && /* @__PURE__ */ jsxs("div", {
2687
- className: "univer-absolute univer-right-2 univer-flex univer-items-center univer-gap-1 univer-rounded-full",
2697
+ className: clsx("univer-absolute univer-flex univer-items-center univer-gap-1 univer-rounded-full", direction === "rtl" ? "univer-left-2" : "univer-right-2"),
2688
2698
  ref: slotRef,
2689
2699
  children: [slot, allowClear && value && !disabled && /* @__PURE__ */ jsx("button", {
2690
2700
  type: "button",
@@ -2699,9 +2709,10 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
2699
2709
  //#endregion
2700
2710
  //#region src/components/input-number/InputNumber.tsx
2701
2711
  const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false }, ref) => {
2712
+ const { locale } = useContext(ConfigContext);
2702
2713
  const [internalValue, setInternalValue] = useState(value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : null);
2703
2714
  const lastValidValueRef = useRef(internalValue);
2704
- const [inputValue, setInputValue] = useState(formatValue(internalValue));
2715
+ const [inputValue, setInputValue] = useState(() => formatValue(internalValue));
2705
2716
  const inputRef = useRef(null);
2706
2717
  const longPressTimerRef = useRef(null);
2707
2718
  const longPressIntervalRef = useRef(null);
@@ -2853,7 +2864,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
2853
2864
  children: [/* @__PURE__ */ jsx("span", {
2854
2865
  className: clsx("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-white dark:hover:!univer-bg-gray-600", incrementDisabled && "univer-cursor-not-allowed univer-opacity-60"),
2855
2866
  role: "button",
2856
- "aria-label": "increment",
2867
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.increment,
2857
2868
  "aria-disabled": incrementDisabled,
2858
2869
  tabIndex: -1,
2859
2870
  onMouseDown: (e) => e.preventDefault(),
@@ -2865,7 +2876,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
2865
2876
  }), /* @__PURE__ */ jsx("span", {
2866
2877
  className: clsx("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-white dark:hover:!univer-bg-gray-600", decrementDisabled && "univer-cursor-not-allowed univer-opacity-60"),
2867
2878
  role: "button",
2868
- "aria-label": "decrement",
2879
+ "aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.decrement,
2869
2880
  "aria-disabled": decrementDisabled,
2870
2881
  tabIndex: -1,
2871
2882
  onMouseDown: (e) => e.preventDefault(),
@@ -2882,7 +2893,9 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
2882
2893
 
2883
2894
  //#endregion
2884
2895
  //#region src/components/segmented/Segmented.tsx
2896
+ const SEGMENTED_PADDING = 4;
2885
2897
  function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2898
+ const { direction } = useContext(ConfigContext);
2886
2899
  const [selectedItem, setSelectedItem] = useState(value !== void 0 ? value : defaultValue || items[0].value);
2887
2900
  const [slideStyle, setSlideStyle] = useState({});
2888
2901
  const itemRefs = useRef(/* @__PURE__ */ new Map());
@@ -2896,14 +2909,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2896
2909
  if (newItemElement && containerRef.current) {
2897
2910
  const containerRect = containerRef.current.getBoundingClientRect();
2898
2911
  const newRect = newItemElement.getBoundingClientRect();
2899
- const newLeft = newRect.left - containerRect.left - 4;
2912
+ const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
2900
2913
  if (oldItemElement) setSlideStyle({
2901
- "--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - 4}px`,
2914
+ "--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING}px`,
2902
2915
  "--slide-to": `${newLeft}px`,
2916
+ left: `${SEGMENTED_PADDING}px`,
2903
2917
  width: `${newRect.width}px`,
2904
2918
  transform: `translateX(${newLeft}px)`
2905
2919
  });
2906
2920
  else setSlideStyle({
2921
+ left: `${SEGMENTED_PADDING}px`,
2907
2922
  width: `${newRect.width}px`,
2908
2923
  transform: `translateX(${newLeft}px)`
2909
2924
  });
@@ -2911,7 +2926,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2911
2926
  };
2912
2927
  useEffect(() => {
2913
2928
  updateSliderPosition(selectedItem);
2914
- }, [selectedItem]);
2929
+ }, [direction, selectedItem]);
2915
2930
  const handleClick = (itemValue) => {
2916
2931
  const oldValue = selectedItem;
2917
2932
  setSelectedItem(itemValue);
@@ -2920,6 +2935,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2920
2935
  };
2921
2936
  return /* @__PURE__ */ jsxs("div", {
2922
2937
  "data-u-comp": "segmented",
2938
+ dir: direction,
2923
2939
  ref: containerRef,
2924
2940
  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),
2925
2941
  children: [/* @__PURE__ */ jsx("div", {
@@ -3193,7 +3209,7 @@ function getCssLinearGradientAngle(value) {
3193
3209
  return (getGradientAngle(value) + 90) % 360;
3194
3210
  }
3195
3211
  function GradientColorPicker(props) {
3196
- var _draftValue$stops$sel, _locale$GradientColor, _draftValue$stops$sel2;
3212
+ var _draftValue$stops$sel, _draftValue$stops$sel2;
3197
3213
  const { className, compact = false, value = DEFAULT_VALUE, onChange } = props;
3198
3214
  const { locale } = useContext(ConfigContext);
3199
3215
  const [draftValue, setDraftValue] = useState(value);
@@ -3461,7 +3477,7 @@ function GradientColorPicker(props) {
3461
3477
  className: "univer-flex-1",
3462
3478
  children: [/* @__PURE__ */ jsx("div", {
3463
3479
  className: "univer-mb-0.5 univer-text-xs univer-text-gray-500",
3464
- children: (_locale$GradientColor = locale === null || locale === void 0 ? void 0 : locale.GradientColorPicker.transparency) !== null && _locale$GradientColor !== void 0 ? _locale$GradientColor : "Transparency"
3480
+ children: locale === null || locale === void 0 ? void 0 : locale.GradientColorPicker.transparency
3465
3481
  }), /* @__PURE__ */ jsx(InputNumber, {
3466
3482
  value: Math.round((1 - getStopOpacity(draftValue.stops[selectedIndex])) * 100),
3467
3483
  min: 0,
@@ -4386,7 +4402,7 @@ function Tree(props) {
4386
4402
  e.stopPropagation();
4387
4403
  handleExpendItem(treeItem);
4388
4404
  },
4389
- children: /* @__PURE__ */ jsx(DropdownIcon, {})
4405
+ children: /* @__PURE__ */ jsx(DownIcon, {})
4390
4406
  }),
4391
4407
  /* @__PURE__ */ jsx(Checkbox, {
4392
4408
  checked: selected && !intermediated,
@@ -4492,4 +4508,4 @@ function resizeObserverCtor(callback) {
4492
4508
  }
4493
4509
 
4494
4510
  //#endregion
4495
- 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 };
4511
+ 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 };
@@ -1,5 +1,15 @@
1
1
  //#region src/locale/ar-SA.ts
2
2
  const locale = { design: {
3
+ Accessibility: {
4
+ closeBadge: "إغلاق الشارة",
5
+ imageGallery: "معرض الصور",
6
+ image: "الصورة {0} من {1}",
7
+ zoomIn: "تكبير",
8
+ zoomOut: "تصغير",
9
+ resetZoom: "إعادة ضبط التكبير",
10
+ increment: "زيادة",
11
+ decrement: "إنقاص"
12
+ },
3
13
  Confirm: {
4
14
  cancel: "إلغاء",
5
15
  confirm: "موافق"
@@ -52,7 +62,7 @@ const locale = { design: {
52
62
  angle: "زاوية",
53
63
  flip: "قلب",
54
64
  delete: "حذف",
55
- transparency: "Transparency"
65
+ transparency: "الشفافية"
56
66
  }
57
67
  } };
58
68
 
@@ -1,5 +1,15 @@
1
1
  //#region src/locale/ca-ES.ts
2
2
  const locale = { design: {
3
+ Accessibility: {
4
+ closeBadge: "Tanca la insígnia",
5
+ imageGallery: "Galeria d’imatges",
6
+ image: "Imatge {0} de {1}",
7
+ zoomIn: "Apropa",
8
+ zoomOut: "Allunya",
9
+ resetZoom: "Restableix el zoom",
10
+ increment: "Incrementa",
11
+ decrement: "Disminueix"
12
+ },
3
13
  Confirm: {
4
14
  cancel: "cancel·la",
5
15
  confirm: "ok"
@@ -52,7 +62,7 @@ const locale = { design: {
52
62
  angle: "Angle",
53
63
  flip: "Girar",
54
64
  delete: "Eliminar",
55
- transparency: "Transparency"
65
+ transparency: "Transparència"
56
66
  }
57
67
  } };
58
68
 
@@ -1,5 +1,15 @@
1
1
  //#region src/locale/de-DE.ts
2
2
  const locale = { design: {
3
+ Accessibility: {
4
+ closeBadge: "Badge schließen",
5
+ imageGallery: "Bildergalerie",
6
+ image: "Bild {0} von {1}",
7
+ zoomIn: "Vergrößern",
8
+ zoomOut: "Verkleinern",
9
+ resetZoom: "Zoom zurücksetzen",
10
+ increment: "Erhöhen",
11
+ decrement: "Verringern"
12
+ },
3
13
  Confirm: {
4
14
  cancel: "Abbrechen",
5
15
  confirm: "OK"
@@ -52,7 +62,7 @@ const locale = { design: {
52
62
  angle: "Winkel",
53
63
  flip: "Umkehren",
54
64
  delete: "Löschen",
55
- transparency: "Transparency"
65
+ transparency: "Transparenz"
56
66
  }
57
67
  } };
58
68
 
@@ -15,6 +15,16 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  const locale = { design: {
18
+ Accessibility: {
19
+ closeBadge: "Close badge",
20
+ imageGallery: "Image gallery",
21
+ image: "Image {0} of {1}",
22
+ zoomIn: "Zoom in",
23
+ zoomOut: "Zoom out",
24
+ resetZoom: "Reset zoom",
25
+ increment: "increment",
26
+ decrement: "decrement"
27
+ },
18
28
  Confirm: {
19
29
  cancel: "cancel",
20
30
  confirm: "ok"