@univerjs/design 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (54) hide show
  1. package/lib/cjs/index.js +37 -79
  2. package/lib/cjs/locale/ar-SA.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +3 -3
  4. package/lib/cjs/locale/de-DE.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fr-FR.js +3 -3
  7. package/lib/cjs/locale/id-ID.js +1 -1
  8. package/lib/cjs/locale/it-IT.js +3 -3
  9. package/lib/cjs/locale/pl-PL.js +3 -3
  10. package/lib/cjs/locale/pt-BR.js +3 -3
  11. package/lib/cjs/locale/ru-RU.js +1 -1
  12. package/lib/cjs/locale/sk-SK.js +3 -3
  13. package/lib/es/index.js +38 -79
  14. package/lib/es/locale/ar-SA.js +1 -1
  15. package/lib/es/locale/ca-ES.js +3 -3
  16. package/lib/es/locale/de-DE.js +1 -1
  17. package/lib/es/locale/es-ES.js +1 -1
  18. package/lib/es/locale/fr-FR.js +3 -3
  19. package/lib/es/locale/id-ID.js +1 -1
  20. package/lib/es/locale/it-IT.js +3 -3
  21. package/lib/es/locale/pl-PL.js +3 -3
  22. package/lib/es/locale/pt-BR.js +3 -3
  23. package/lib/es/locale/ru-RU.js +1 -1
  24. package/lib/es/locale/sk-SK.js +3 -3
  25. package/lib/index.css +26 -77
  26. package/lib/index.js +38 -79
  27. package/lib/locale/ar-SA.js +1 -1
  28. package/lib/locale/ca-ES.js +3 -3
  29. package/lib/locale/de-DE.js +1 -1
  30. package/lib/locale/es-ES.js +1 -1
  31. package/lib/locale/fr-FR.js +3 -3
  32. package/lib/locale/id-ID.js +1 -1
  33. package/lib/locale/it-IT.js +3 -3
  34. package/lib/locale/pl-PL.js +3 -3
  35. package/lib/locale/pt-BR.js +3 -3
  36. package/lib/locale/ru-RU.js +1 -1
  37. package/lib/locale/sk-SK.js +3 -3
  38. package/lib/types/components/dialog/Dialog.d.ts +0 -6
  39. package/lib/types/components/popup/Popup.d.ts +0 -1
  40. package/lib/types/index.d.ts +0 -1
  41. package/lib/umd/index.js +14 -14
  42. package/lib/umd/locale/ar-SA.js +1 -1
  43. package/lib/umd/locale/ca-ES.js +1 -1
  44. package/lib/umd/locale/de-DE.js +1 -1
  45. package/lib/umd/locale/es-ES.js +1 -1
  46. package/lib/umd/locale/fr-FR.js +1 -1
  47. package/lib/umd/locale/id-ID.js +1 -1
  48. package/lib/umd/locale/it-IT.js +1 -1
  49. package/lib/umd/locale/pl-PL.js +1 -1
  50. package/lib/umd/locale/pt-BR.js +1 -1
  51. package/lib/umd/locale/ru-RU.js +1 -1
  52. package/lib/umd/locale/sk-SK.js +1 -1
  53. package/package.json +10 -12
  54. package/lib/types/helper/resize-observer.d.ts +0 -19
package/lib/cjs/index.js CHANGED
@@ -14,7 +14,6 @@ let cmdk = require("cmdk");
14
14
  let react_dom = require("react-dom");
15
15
  let _radix_ui_react_hover_card = require("@radix-ui/react-hover-card");
16
16
  let sonner = require("sonner");
17
- let react_transition_group = require("react-transition-group");
18
17
  let _radix_ui_react_separator = require("@radix-ui/react-separator");
19
18
  let react_dom_client = require("react-dom/client");
20
19
 
@@ -1109,7 +1108,8 @@ function useDraggable(options = {}) {
1109
1108
  if (!isDragging) return;
1110
1109
  e.preventDefault();
1111
1110
  e.stopPropagation();
1112
- setPosition(calculateBounds(e.clientX, e.clientY));
1111
+ const newPosition = calculateBounds(e.clientX, e.clientY);
1112
+ setPosition(newPosition);
1113
1113
  }, [isDragging, calculateBounds]);
1114
1114
  const endDrag = (0, react.useCallback)(() => {
1115
1115
  setIsDragging(false);
@@ -1506,10 +1506,11 @@ function RgbInput({ hsv, alpha, format, onChange }) {
1506
1506
  if (value !== "" && !/^\d*\.?\d*$/.test(value)) return;
1507
1507
  const numValue = value === "" ? 0 : Number.parseFloat(value);
1508
1508
  if (numValue > 1) return;
1509
- setLocalValues({
1509
+ const newValues = {
1510
1510
  ...localValues,
1511
1511
  a: numValue
1512
- });
1512
+ };
1513
+ setLocalValues(newValues);
1513
1514
  if (onChange) onChange(hsv[0], hsv[1], hsv[2], numValue);
1514
1515
  return;
1515
1516
  }
@@ -2394,7 +2395,10 @@ function DraggableList(props) {
2394
2395
  onPointerDownCapture: (e) => {
2395
2396
  if (pointerIdRef.current !== null) return;
2396
2397
  if (!draggableHandle) pressedHandleIdRef.current = itemId;
2397
- else pressedHandleIdRef.current = !!e.target.closest(draggableHandle) ? itemId : null;
2398
+ else {
2399
+ const isMatched = !!e.target.closest(draggableHandle);
2400
+ pressedHandleIdRef.current = isMatched ? itemId : null;
2401
+ }
2398
2402
  if (pressedHandleIdRef.current !== itemId) return;
2399
2403
  const rect = e.currentTarget.getBoundingClientRect();
2400
2404
  dragPointerOffsetRef.current = {
@@ -2976,14 +2980,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2976
2980
  const containerRect = containerRef.current.getBoundingClientRect();
2977
2981
  const newRect = newItemElement.getBoundingClientRect();
2978
2982
  const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
2979
- if (oldItemElement) setSlideStyle({
2980
- "--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING}px`,
2981
- "--slide-to": `${newLeft}px`,
2982
- left: `${SEGMENTED_PADDING}px`,
2983
- width: `${newRect.width}px`,
2984
- transform: `translateX(${newLeft}px)`
2985
- });
2986
- else setSlideStyle({
2983
+ if (oldItemElement) {
2984
+ const oldLeft = oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING;
2985
+ setSlideStyle({
2986
+ "--slide-from": `${oldLeft}px`,
2987
+ "--slide-to": `${newLeft}px`,
2988
+ left: `${SEGMENTED_PADDING}px`,
2989
+ width: `${newRect.width}px`,
2990
+ transform: `translateX(${newLeft}px)`
2991
+ });
2992
+ } else setSlideStyle({
2987
2993
  left: `${SEGMENTED_PADDING}px`,
2988
2994
  width: `${newRect.width}px`,
2989
2995
  transform: `translateX(${newLeft}px)`
@@ -3839,9 +3845,10 @@ function PanelField(props) {
3839
3845
  //#endregion
3840
3846
  //#region src/components/popup/Popup.tsx
3841
3847
  const POPUP_POINTER_OFFSET = 2;
3848
+ const DEFAULT_POPUP_OFFSET = [0, 0];
3842
3849
  const HIDDEN_POPUP_OFFSET = [-9999, -9999];
3843
3850
  function Popup(props) {
3844
- const { children, visible = false, offset = [0, 0], overflowVisible = false, placementY = "below" } = props;
3851
+ const { children, visible = false, offset = DEFAULT_POPUP_OFFSET, overflowVisible = false, placementY = "below" } = props;
3845
3852
  const nodeRef = (0, react.useRef)(null);
3846
3853
  const [realOffset, setRealOffset] = (0, react.useState)(HIDDEN_POPUP_OFFSET);
3847
3854
  const { mountContainer, direction } = (0, react.useContext)(ConfigContext);
@@ -3887,29 +3894,17 @@ function Popup(props) {
3887
3894
  function preventDefault(event) {
3888
3895
  event.preventDefault();
3889
3896
  }
3890
- return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_transition_group.CSSTransition, {
3891
- in: visible,
3892
- nodeRef,
3893
- timeout: 500,
3894
- classNames: {
3895
- enter: "univer-popup-enter",
3896
- enterActive: "univer-popup-enter-active",
3897
- enterDone: "univer-popup-enter-done",
3898
- exitActive: "univer-popup-exit",
3899
- exitDone: "univer-popup-exit-active"
3897
+ return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
3898
+ ref: nodeRef,
3899
+ dir: direction,
3900
+ className: clsx$1("univer-popup univer-fixed univer-z-[1070] univer-origin-top-left univer-overflow-hidden univer-rounded-md univer-shadow univer-transition-[transform,opacity] univer-duration-150", visible ? "univer-[transition-timing-function:cubic-bezier(0.08,0.82,0.17,1)] univer-scale-y-100 univer-opacity-100" : "univer-[transition-timing-function:cubic-bezier(0.6,0.04,0.98,0.34)] univer-scale-y-0 univer-opacity-0"),
3901
+ style: {
3902
+ left: realOffset[0] + POPUP_POINTER_OFFSET,
3903
+ top: realOffset[1] + POPUP_POINTER_OFFSET,
3904
+ overflow: overflowVisible ? "visible" : void 0
3900
3905
  },
3901
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
3902
- ref: nodeRef,
3903
- dir: direction,
3904
- className: "univer-popup",
3905
- style: {
3906
- left: realOffset[0] + POPUP_POINTER_OFFSET,
3907
- top: realOffset[1] + POPUP_POINTER_OFFSET,
3908
- overflow: overflowVisible ? "visible" : void 0
3909
- },
3910
- onContextMenu: preventDefault,
3911
- children
3912
- })
3906
+ onContextMenu: preventDefault,
3907
+ children
3913
3908
  }), mountContainer);
3914
3909
  }
3915
3910
 
@@ -4116,13 +4111,15 @@ function MultipleSelect(props) {
4116
4111
  disabled: option.disabled,
4117
4112
  checked: value.includes(option.value),
4118
4113
  onSelect: (item) => {
4119
- onChange(value.includes(item) ? value.filter((v) => v !== item) : [...value, item]);
4114
+ const newValue = value.includes(item) ? value.filter((v) => v !== item) : [...value, item];
4115
+ onChange(newValue);
4120
4116
  }
4121
4117
  };
4122
4118
  });
4123
4119
  }, [options]);
4124
4120
  function handleClose(item) {
4125
- onChange(value.filter((v) => v !== item));
4121
+ const newValue = value.filter((v) => v !== item);
4122
+ onChange(newValue);
4126
4123
  }
4127
4124
  const displayValue = (0, react.useMemo)(() => {
4128
4125
  return options.filter((option) => value.includes(option.value)).map((option, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
@@ -4380,7 +4377,8 @@ const filterLeafNode = (tree, keyList) => {
4380
4377
  const result = [];
4381
4378
  const find = createCacheWithFindNodePathFromTree(tree);
4382
4379
  keyList.forEach((key) => {
4383
- const node = findNodeFromPath(tree, find.findNodePathFromTreeWithCache(key));
4380
+ const path = find.findNodePathFromTreeWithCache(key);
4381
+ const node = findNodeFromPath(tree, path);
4384
4382
  if (node) {
4385
4383
  var _node$children3;
4386
4384
  if (!((_node$children3 = node.children) === null || _node$children3 === void 0 ? void 0 : _node$children3.length)) result.push(node);
@@ -4534,45 +4532,6 @@ function unmount(container) {
4534
4532
  }
4535
4533
  }
4536
4534
 
4537
- //#endregion
4538
- //#region src/helper/resize-observer.ts
4539
- /**
4540
- * Copyright 2023-present DreamNum Co., Ltd.
4541
- *
4542
- * Licensed under the Apache License, Version 2.0 (the "License");
4543
- * you may not use this file except in compliance with the License.
4544
- * You may obtain a copy of the License at
4545
- *
4546
- * http://www.apache.org/licenses/LICENSE-2.0
4547
- *
4548
- * Unless required by applicable law or agreed to in writing, software
4549
- * distributed under the License is distributed on an "AS IS" BASIS,
4550
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4551
- * See the License for the specific language governing permissions and
4552
- * limitations under the License.
4553
- */
4554
- /**
4555
- * All elements are observed by a single ResizeObserver is got greater performance than each element observed by separate ResizeObserver
4556
- * See issue https://github.com/WICG/resize-observer/issues/59#issuecomment-408098151
4557
- */
4558
- const _resizeObserverCallbacks = /* @__PURE__ */ new Set();
4559
- let _resizeObserver;
4560
- function resizeObserverCtor(callback) {
4561
- if (!_resizeObserver) _resizeObserver = new ResizeObserver((...args) => {
4562
- _resizeObserverCallbacks.forEach((callback) => callback(...args));
4563
- });
4564
- return {
4565
- observe(target, options) {
4566
- _resizeObserverCallbacks.add(callback);
4567
- _resizeObserver.observe(target, options);
4568
- },
4569
- unobserve(target) {
4570
- _resizeObserverCallbacks.delete(callback);
4571
- _resizeObserver.unobserve(target);
4572
- }
4573
- };
4574
- }
4575
-
4576
4535
  //#endregion
4577
4536
  exports.Accordion = Accordion;
4578
4537
  exports.Avatar = Avatar;
@@ -4655,7 +4614,6 @@ exports.message = message;
4655
4614
  exports.removeMessage = removeMessage;
4656
4615
  exports.render = render;
4657
4616
  exports.resetButtonClassName = resetButtonClassName;
4658
- exports.resizeObserverCtor = resizeObserverCtor;
4659
4617
  exports.scrollbarClassName = scrollbarClassName;
4660
4618
  exports.selectClassName = selectClassName;
4661
4619
  exports.toast = sonner.toast;
@@ -17,7 +17,7 @@ const locale = { design: {
17
17
  },
18
18
  CascaderList: { empty: "لا شيء" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "سنة",
21
21
  weekDays: [
22
22
  "ح",
23
23
  "ن",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "cancel·la",
16
- confirm: "ok"
16
+ confirm: "D'acord"
17
17
  },
18
18
  CascaderList: { empty: "Cap" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Any",
21
21
  weekDays: [
22
22
  "dg",
23
23
  "dl",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Més colors",
54
54
  cancel: "cancel·la",
55
- confirm: "ok"
55
+ confirm: "D'acord"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Lineal",
@@ -17,7 +17,7 @@ const locale = { design: {
17
17
  },
18
18
  CascaderList: { empty: "Keine" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Jahr",
21
21
  weekDays: [
22
22
  "So",
23
23
  "Mo",
@@ -17,7 +17,7 @@ const locale = { design: {
17
17
  },
18
18
  CascaderList: { empty: "Cap" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Año",
21
21
  weekDays: [
22
22
  "Dg",
23
23
  "Dl",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "annuler",
16
- confirm: "ok"
16
+ confirm: "OK"
17
17
  },
18
18
  CascaderList: { empty: "Aucun" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Année",
21
21
  weekDays: [
22
22
  "Dim",
23
23
  "Lun",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Plus de couleurs",
54
54
  cancel: "annuler",
55
- confirm: "ok"
55
+ confirm: "OK"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Linéaire",
@@ -17,7 +17,7 @@ const locale = { design: {
17
17
  },
18
18
  CascaderList: { empty: "Tidak ada" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Tahun",
21
21
  weekDays: [
22
22
  "Min",
23
23
  "Sen",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "annulla",
16
- confirm: "ok"
16
+ confirm: "OK"
17
17
  },
18
18
  CascaderList: { empty: "Nessuno" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Anno",
21
21
  weekDays: [
22
22
  "Dom",
23
23
  "Lun",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Altri Colori",
54
54
  cancel: "annulla",
55
- confirm: "ok"
55
+ confirm: "OK"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Lineare",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "anuluj",
16
- confirm: "ok"
16
+ confirm: "OK"
17
17
  },
18
18
  CascaderList: { empty: "Brak" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Rok",
21
21
  weekDays: [
22
22
  "nd",
23
23
  "pn",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Więcej kolorów",
54
54
  cancel: "anuluj",
55
- confirm: "ok"
55
+ confirm: "OK"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Liniowy",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "cancelar",
16
- confirm: "ok"
16
+ confirm: "OK"
17
17
  },
18
18
  CascaderList: { empty: "Nenhum" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Ano",
21
21
  weekDays: [
22
22
  "Dom",
23
23
  "Seg",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Mais Cores",
54
54
  cancel: "cancelar",
55
- confirm: "ok"
55
+ confirm: "OK"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Linear",
@@ -18,7 +18,7 @@ const locale = { design: {
18
18
  CascaderList: { empty: "Нет" },
19
19
  Select: { empty: "Нет" },
20
20
  Calendar: {
21
- year: "",
21
+ year: "Год",
22
22
  weekDays: [
23
23
  "Вс",
24
24
  "Пн",
@@ -13,11 +13,11 @@ const locale = { design: {
13
13
  },
14
14
  Confirm: {
15
15
  cancel: "zrušiť",
16
- confirm: "ok"
16
+ confirm: "OK"
17
17
  },
18
18
  CascaderList: { empty: "Žiadne" },
19
19
  Calendar: {
20
- year: "",
20
+ year: "Rok",
21
21
  weekDays: [
22
22
  "Ne",
23
23
  "Po",
@@ -52,7 +52,7 @@ const locale = { design: {
52
52
  ColorPicker: {
53
53
  more: "Viac farieb",
54
54
  cancel: "zrušiť",
55
- confirm: "ok"
55
+ confirm: "OK"
56
56
  },
57
57
  GradientColorPicker: {
58
58
  linear: "Lineárny",
package/lib/es/index.js CHANGED
@@ -13,7 +13,6 @@ import { Command as Command$1 } from "cmdk";
13
13
  import { createPortal } from "react-dom";
14
14
  import { Content as Content$3, Portal as Portal$3, Root as Root$3, Trigger as Trigger$2 } from "@radix-ui/react-hover-card";
15
15
  import { Toaster as Toaster$1, toast, toast as toast$1 } from "sonner";
16
- import { CSSTransition } from "react-transition-group";
17
16
  import { Root as Root$4 } from "@radix-ui/react-separator";
18
17
  import { createRoot } from "react-dom/client";
19
18
 
@@ -1108,7 +1107,8 @@ function useDraggable(options = {}) {
1108
1107
  if (!isDragging) return;
1109
1108
  e.preventDefault();
1110
1109
  e.stopPropagation();
1111
- setPosition(calculateBounds(e.clientX, e.clientY));
1110
+ const newPosition = calculateBounds(e.clientX, e.clientY);
1111
+ setPosition(newPosition);
1112
1112
  }, [isDragging, calculateBounds]);
1113
1113
  const endDrag = useCallback(() => {
1114
1114
  setIsDragging(false);
@@ -1505,10 +1505,11 @@ function RgbInput({ hsv, alpha, format, onChange }) {
1505
1505
  if (value !== "" && !/^\d*\.?\d*$/.test(value)) return;
1506
1506
  const numValue = value === "" ? 0 : Number.parseFloat(value);
1507
1507
  if (numValue > 1) return;
1508
- setLocalValues({
1508
+ const newValues = {
1509
1509
  ...localValues,
1510
1510
  a: numValue
1511
- });
1511
+ };
1512
+ setLocalValues(newValues);
1512
1513
  if (onChange) onChange(hsv[0], hsv[1], hsv[2], numValue);
1513
1514
  return;
1514
1515
  }
@@ -2393,7 +2394,10 @@ function DraggableList(props) {
2393
2394
  onPointerDownCapture: (e) => {
2394
2395
  if (pointerIdRef.current !== null) return;
2395
2396
  if (!draggableHandle) pressedHandleIdRef.current = itemId;
2396
- else pressedHandleIdRef.current = !!e.target.closest(draggableHandle) ? itemId : null;
2397
+ else {
2398
+ const isMatched = !!e.target.closest(draggableHandle);
2399
+ pressedHandleIdRef.current = isMatched ? itemId : null;
2400
+ }
2397
2401
  if (pressedHandleIdRef.current !== itemId) return;
2398
2402
  const rect = e.currentTarget.getBoundingClientRect();
2399
2403
  dragPointerOffsetRef.current = {
@@ -2975,14 +2979,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
2975
2979
  const containerRect = containerRef.current.getBoundingClientRect();
2976
2980
  const newRect = newItemElement.getBoundingClientRect();
2977
2981
  const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
2978
- if (oldItemElement) setSlideStyle({
2979
- "--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING}px`,
2980
- "--slide-to": `${newLeft}px`,
2981
- left: `${SEGMENTED_PADDING}px`,
2982
- width: `${newRect.width}px`,
2983
- transform: `translateX(${newLeft}px)`
2984
- });
2985
- else setSlideStyle({
2982
+ if (oldItemElement) {
2983
+ const oldLeft = oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING;
2984
+ setSlideStyle({
2985
+ "--slide-from": `${oldLeft}px`,
2986
+ "--slide-to": `${newLeft}px`,
2987
+ left: `${SEGMENTED_PADDING}px`,
2988
+ width: `${newRect.width}px`,
2989
+ transform: `translateX(${newLeft}px)`
2990
+ });
2991
+ } else setSlideStyle({
2986
2992
  left: `${SEGMENTED_PADDING}px`,
2987
2993
  width: `${newRect.width}px`,
2988
2994
  transform: `translateX(${newLeft}px)`
@@ -3838,9 +3844,10 @@ function PanelField(props) {
3838
3844
  //#endregion
3839
3845
  //#region src/components/popup/Popup.tsx
3840
3846
  const POPUP_POINTER_OFFSET = 2;
3847
+ const DEFAULT_POPUP_OFFSET = [0, 0];
3841
3848
  const HIDDEN_POPUP_OFFSET = [-9999, -9999];
3842
3849
  function Popup(props) {
3843
- const { children, visible = false, offset = [0, 0], overflowVisible = false, placementY = "below" } = props;
3850
+ const { children, visible = false, offset = DEFAULT_POPUP_OFFSET, overflowVisible = false, placementY = "below" } = props;
3844
3851
  const nodeRef = useRef(null);
3845
3852
  const [realOffset, setRealOffset] = useState(HIDDEN_POPUP_OFFSET);
3846
3853
  const { mountContainer, direction } = useContext(ConfigContext);
@@ -3886,29 +3893,17 @@ function Popup(props) {
3886
3893
  function preventDefault(event) {
3887
3894
  event.preventDefault();
3888
3895
  }
3889
- return createPortal(/* @__PURE__ */ jsx(CSSTransition, {
3890
- in: visible,
3891
- nodeRef,
3892
- timeout: 500,
3893
- classNames: {
3894
- enter: "univer-popup-enter",
3895
- enterActive: "univer-popup-enter-active",
3896
- enterDone: "univer-popup-enter-done",
3897
- exitActive: "univer-popup-exit",
3898
- exitDone: "univer-popup-exit-active"
3896
+ return createPortal(/* @__PURE__ */ jsx("section", {
3897
+ ref: nodeRef,
3898
+ dir: direction,
3899
+ className: clsx("univer-popup univer-fixed univer-z-[1070] univer-origin-top-left univer-overflow-hidden univer-rounded-md univer-shadow univer-transition-[transform,opacity] univer-duration-150", visible ? "univer-[transition-timing-function:cubic-bezier(0.08,0.82,0.17,1)] univer-scale-y-100 univer-opacity-100" : "univer-[transition-timing-function:cubic-bezier(0.6,0.04,0.98,0.34)] univer-scale-y-0 univer-opacity-0"),
3900
+ style: {
3901
+ left: realOffset[0] + POPUP_POINTER_OFFSET,
3902
+ top: realOffset[1] + POPUP_POINTER_OFFSET,
3903
+ overflow: overflowVisible ? "visible" : void 0
3899
3904
  },
3900
- children: /* @__PURE__ */ jsx("section", {
3901
- ref: nodeRef,
3902
- dir: direction,
3903
- className: "univer-popup",
3904
- style: {
3905
- left: realOffset[0] + POPUP_POINTER_OFFSET,
3906
- top: realOffset[1] + POPUP_POINTER_OFFSET,
3907
- overflow: overflowVisible ? "visible" : void 0
3908
- },
3909
- onContextMenu: preventDefault,
3910
- children
3911
- })
3905
+ onContextMenu: preventDefault,
3906
+ children
3912
3907
  }), mountContainer);
3913
3908
  }
3914
3909
 
@@ -4115,13 +4110,15 @@ function MultipleSelect(props) {
4115
4110
  disabled: option.disabled,
4116
4111
  checked: value.includes(option.value),
4117
4112
  onSelect: (item) => {
4118
- onChange(value.includes(item) ? value.filter((v) => v !== item) : [...value, item]);
4113
+ const newValue = value.includes(item) ? value.filter((v) => v !== item) : [...value, item];
4114
+ onChange(newValue);
4119
4115
  }
4120
4116
  };
4121
4117
  });
4122
4118
  }, [options]);
4123
4119
  function handleClose(item) {
4124
- onChange(value.filter((v) => v !== item));
4120
+ const newValue = value.filter((v) => v !== item);
4121
+ onChange(newValue);
4125
4122
  }
4126
4123
  const displayValue = useMemo(() => {
4127
4124
  return options.filter((option) => value.includes(option.value)).map((option, index) => /* @__PURE__ */ jsx(Badge, {
@@ -4379,7 +4376,8 @@ const filterLeafNode = (tree, keyList) => {
4379
4376
  const result = [];
4380
4377
  const find = createCacheWithFindNodePathFromTree(tree);
4381
4378
  keyList.forEach((key) => {
4382
- const node = findNodeFromPath(tree, find.findNodePathFromTreeWithCache(key));
4379
+ const path = find.findNodePathFromTreeWithCache(key);
4380
+ const node = findNodeFromPath(tree, path);
4383
4381
  if (node) {
4384
4382
  var _node$children3;
4385
4383
  if (!((_node$children3 = node.children) === null || _node$children3 === void 0 ? void 0 : _node$children3.length)) result.push(node);
@@ -4534,43 +4532,4 @@ function unmount(container) {
4534
4532
  }
4535
4533
 
4536
4534
  //#endregion
4537
- //#region src/helper/resize-observer.ts
4538
- /**
4539
- * Copyright 2023-present DreamNum Co., Ltd.
4540
- *
4541
- * Licensed under the Apache License, Version 2.0 (the "License");
4542
- * you may not use this file except in compliance with the License.
4543
- * You may obtain a copy of the License at
4544
- *
4545
- * http://www.apache.org/licenses/LICENSE-2.0
4546
- *
4547
- * Unless required by applicable law or agreed to in writing, software
4548
- * distributed under the License is distributed on an "AS IS" BASIS,
4549
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4550
- * See the License for the specific language governing permissions and
4551
- * limitations under the License.
4552
- */
4553
- /**
4554
- * All elements are observed by a single ResizeObserver is got greater performance than each element observed by separate ResizeObserver
4555
- * See issue https://github.com/WICG/resize-observer/issues/59#issuecomment-408098151
4556
- */
4557
- const _resizeObserverCallbacks = /* @__PURE__ */ new Set();
4558
- let _resizeObserver;
4559
- function resizeObserverCtor(callback) {
4560
- if (!_resizeObserver) _resizeObserver = new ResizeObserver((...args) => {
4561
- _resizeObserverCallbacks.forEach((callback) => callback(...args));
4562
- });
4563
- return {
4564
- observe(target, options) {
4565
- _resizeObserverCallbacks.add(callback);
4566
- _resizeObserver.observe(target, options);
4567
- },
4568
- unobserve(target) {
4569
- _resizeObserverCallbacks.delete(callback);
4570
- _resizeObserver.unobserve(target);
4571
- }
4572
- };
4573
- }
4574
-
4575
- //#endregion
4576
- export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, 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 };
4535
+ export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, 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, scrollbarClassName, selectClassName, toast, unmount };
@@ -16,7 +16,7 @@ const locale = { design: {
16
16
  },
17
17
  CascaderList: { empty: "لا شيء" },
18
18
  Calendar: {
19
- year: "",
19
+ year: "سنة",
20
20
  weekDays: [
21
21
  "ح",
22
22
  "ن",
@@ -12,11 +12,11 @@ const locale = { design: {
12
12
  },
13
13
  Confirm: {
14
14
  cancel: "cancel·la",
15
- confirm: "ok"
15
+ confirm: "D'acord"
16
16
  },
17
17
  CascaderList: { empty: "Cap" },
18
18
  Calendar: {
19
- year: "",
19
+ year: "Any",
20
20
  weekDays: [
21
21
  "dg",
22
22
  "dl",
@@ -51,7 +51,7 @@ const locale = { design: {
51
51
  ColorPicker: {
52
52
  more: "Més colors",
53
53
  cancel: "cancel·la",
54
- confirm: "ok"
54
+ confirm: "D'acord"
55
55
  },
56
56
  GradientColorPicker: {
57
57
  linear: "Lineal",
@@ -16,7 +16,7 @@ const locale = { design: {
16
16
  },
17
17
  CascaderList: { empty: "Keine" },
18
18
  Calendar: {
19
- year: "",
19
+ year: "Jahr",
20
20
  weekDays: [
21
21
  "So",
22
22
  "Mo",
@@ -16,7 +16,7 @@ const locale = { design: {
16
16
  },
17
17
  CascaderList: { empty: "Cap" },
18
18
  Calendar: {
19
- year: "",
19
+ year: "Año",
20
20
  weekDays: [
21
21
  "Dg",
22
22
  "Dl",
@@ -12,11 +12,11 @@ const locale = { design: {
12
12
  },
13
13
  Confirm: {
14
14
  cancel: "annuler",
15
- confirm: "ok"
15
+ confirm: "OK"
16
16
  },
17
17
  CascaderList: { empty: "Aucun" },
18
18
  Calendar: {
19
- year: "",
19
+ year: "Année",
20
20
  weekDays: [
21
21
  "Dim",
22
22
  "Lun",
@@ -51,7 +51,7 @@ const locale = { design: {
51
51
  ColorPicker: {
52
52
  more: "Plus de couleurs",
53
53
  cancel: "annuler",
54
- confirm: "ok"
54
+ confirm: "OK"
55
55
  },
56
56
  GradientColorPicker: {
57
57
  linear: "Linéaire",