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