@univerjs/design 1.0.0-alpha.1 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +60 -47
- package/lib/es/index.js +60 -47
- package/lib/index.css +34 -0
- package/lib/index.js +60 -47
- package/lib/types/components/dialog/DialogPrimitive.d.ts +1 -0
- package/lib/umd/index.js +14 -18
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -168,32 +168,6 @@ const Button = (0, react.forwardRef)(({ className, variant, size, asChild = fals
|
|
|
168
168
|
});
|
|
169
169
|
Button.displayName = "Button";
|
|
170
170
|
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/components/button/ButtonGroup.tsx
|
|
173
|
-
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
174
|
-
const totalButtons = react.Children.count(children);
|
|
175
|
-
const isHorizontal = orientation === "horizontal";
|
|
176
|
-
const isVertical = orientation === "vertical";
|
|
177
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
178
|
-
className: clsx$1("univer-grid", {
|
|
179
|
-
"univer-grid-flow-row": isVertical,
|
|
180
|
-
"univer-w-fit": isVertical
|
|
181
|
-
}, className),
|
|
182
|
-
children: react.Children.map(children, (child, index) => {
|
|
183
|
-
const isFirst = index === 0;
|
|
184
|
-
const isLast = index === totalButtons - 1;
|
|
185
|
-
return (0, react.cloneElement)(child, { className: clsx$1({
|
|
186
|
-
"!univer-rounded-l-none": isHorizontal && !isFirst,
|
|
187
|
-
"!univer-rounded-r-none": isHorizontal && !isLast,
|
|
188
|
-
"!univer-border-l-0": isHorizontal && !isFirst,
|
|
189
|
-
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
190
|
-
"!univer-rounded-b-none": isVertical && !isLast,
|
|
191
|
-
"!univer-border-t-0": isVertical && !isFirst
|
|
192
|
-
}, child.props.className) });
|
|
193
|
-
})
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
171
|
//#endregion
|
|
198
172
|
//#region src/helper/is-browser.ts
|
|
199
173
|
/**
|
|
@@ -240,6 +214,35 @@ function ConfigProvider(props) {
|
|
|
240
214
|
});
|
|
241
215
|
}
|
|
242
216
|
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/components/button/ButtonGroup.tsx
|
|
219
|
+
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
220
|
+
const { direction } = (0, react.useContext)(ConfigContext);
|
|
221
|
+
const totalButtons = react.Children.count(children);
|
|
222
|
+
const isHorizontal = orientation === "horizontal";
|
|
223
|
+
const isVertical = orientation === "vertical";
|
|
224
|
+
const isRtl = direction === "rtl";
|
|
225
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
226
|
+
className: clsx$1("univer-grid", {
|
|
227
|
+
"univer-grid-flow-row": isVertical,
|
|
228
|
+
"univer-w-fit": isVertical
|
|
229
|
+
}, className),
|
|
230
|
+
children: react.Children.map(children, (child, index) => {
|
|
231
|
+
const isFirst = index === 0;
|
|
232
|
+
const isLast = index === totalButtons - 1;
|
|
233
|
+
return (0, react.cloneElement)(child, { className: clsx$1({
|
|
234
|
+
"!univer-rounded-l-none": isHorizontal && (isRtl ? !isLast : !isFirst),
|
|
235
|
+
"!univer-rounded-r-none": isHorizontal && (isRtl ? !isFirst : !isLast),
|
|
236
|
+
"!univer-border-l-0": isHorizontal && !isRtl && !isFirst,
|
|
237
|
+
"!univer-border-r-0": isHorizontal && isRtl && !isFirst,
|
|
238
|
+
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
239
|
+
"!univer-rounded-b-none": isVertical && !isLast,
|
|
240
|
+
"!univer-border-t-0": isVertical && !isFirst
|
|
241
|
+
}, child.props.className) });
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
|
|
243
246
|
//#endregion
|
|
244
247
|
//#region src/helper/class-utilities.ts
|
|
245
248
|
/**
|
|
@@ -979,22 +982,27 @@ const DialogOverlay = (0, react.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
979
982
|
...props
|
|
980
983
|
}));
|
|
981
984
|
DialogOverlay.displayName = _radix_ui_react_dialog.Overlay.displayName;
|
|
982
|
-
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
className: "univer-
|
|
991
|
-
|
|
985
|
+
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
986
|
+
container: mountContainer !== null && mountContainer !== void 0 ? mountContainer : void 0,
|
|
987
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
|
|
988
|
+
ref,
|
|
989
|
+
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=open]:univer-slide-in-from-left-1/2 data-[state=open]:univer-slide-in-from-top-[48%] data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[state=closed]:univer-slide-out-to-left-1/2 data-[state=closed]:univer-slide-out-to-top-[48%] univer-fixed univer-left-1/2 univer-top-1/2 univer-z-[1080] univer-box-border univer-grid univer-w-full univer-max-w-lg -univer-translate-x-1/2 -univer-translate-y-1/2 univer-gap-4 univer-bg-white univer-p-4 univer-text-gray-500 univer-shadow-md univer-duration-200 sm:!univer-rounded-lg dark:!univer-bg-gray-700 dark:!univer-text-gray-400", borderClassName, className),
|
|
990
|
+
...props,
|
|
991
|
+
children: [children, closable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Close, {
|
|
992
|
+
"data-slot": "close",
|
|
993
|
+
className: "univer-absolute univer-right-4 univer-top-4 univer-size-6 univer-cursor-pointer univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-transition-opacity hover:univer-opacity-100 disabled:univer-pointer-events-none rtl:univer-left-4 rtl:univer-right-auto",
|
|
994
|
+
onClick: onClickClose,
|
|
995
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, { className: "univer-size-4 univer-text-gray-400" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
996
|
+
className: "univer-sr-only",
|
|
997
|
+
children: "Close"
|
|
998
|
+
})]
|
|
992
999
|
})]
|
|
993
1000
|
})]
|
|
994
|
-
})
|
|
1001
|
+
}));
|
|
995
1002
|
DialogContent.displayName = _radix_ui_react_dialog.Content.displayName;
|
|
996
1003
|
const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
997
|
-
|
|
1004
|
+
"data-slot": "dialog-header",
|
|
1005
|
+
className: clsx$1("univer-flex univer-flex-col univer-space-y-1.5 univer-text-center sm:!univer-text-left sm:rtl:!univer-text-right", className),
|
|
998
1006
|
...props
|
|
999
1007
|
});
|
|
1000
1008
|
DialogHeader.displayName = "DialogHeader";
|
|
@@ -1137,7 +1145,7 @@ function useDraggable(options = {}) {
|
|
|
1137
1145
|
function Dialog(props) {
|
|
1138
1146
|
var _locale$Confirm$cance, _locale$Confirm, _locale$Confirm$confi, _locale$Confirm2;
|
|
1139
1147
|
const { className, children, style, open = false, title, width, draggable = false, defaultPosition, footer: propFooter, mask = true, keyboard = true, closable = true, maskClosable = true, showOk, showCancel, onOpenChange, onClose, onOk, onCancel } = props;
|
|
1140
|
-
const { locale } = (0, react.useContext)(ConfigContext);
|
|
1148
|
+
const { locale, mountContainer, direction } = (0, react.useContext)(ConfigContext);
|
|
1141
1149
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1142
1150
|
defaultPosition,
|
|
1143
1151
|
enabled: draggable
|
|
@@ -1187,6 +1195,8 @@ function Dialog(props) {
|
|
|
1187
1195
|
} : {}
|
|
1188
1196
|
},
|
|
1189
1197
|
closable,
|
|
1198
|
+
mountContainer,
|
|
1199
|
+
dir: direction,
|
|
1190
1200
|
onClickClose: handleClickClose,
|
|
1191
1201
|
onEscapeKeyDown: (e) => {
|
|
1192
1202
|
if (keyboard) handleClickClose();
|
|
@@ -1453,14 +1463,14 @@ function HexInput({ hsv, onChange }) {
|
|
|
1453
1463
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1454
1464
|
};
|
|
1455
1465
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1456
|
-
className: clsx$1("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-text-white", borderClassName),
|
|
1466
|
+
className: clsx$1("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none rtl:!univer-pl-2 rtl:!univer-pr-4 dark:!univer-text-white", borderClassName),
|
|
1457
1467
|
value: inputValue,
|
|
1458
1468
|
onChange: handleChange,
|
|
1459
1469
|
onBlur: handleBlur,
|
|
1460
1470
|
maxLength: 6,
|
|
1461
1471
|
spellCheck: false
|
|
1462
1472
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1463
|
-
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400",
|
|
1473
|
+
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400 rtl:univer-left-auto rtl:univer-right-1.5",
|
|
1464
1474
|
children: "#"
|
|
1465
1475
|
})] });
|
|
1466
1476
|
}
|
|
@@ -1896,7 +1906,7 @@ const MemoizedColorInput = (0, react.memo)(ColorInput);
|
|
|
1896
1906
|
const MemoizedColorPresets = (0, react.memo)(ColorPresets);
|
|
1897
1907
|
function ColorPicker({ format = "hex", value, onChange }) {
|
|
1898
1908
|
if (!isBrowser) return null;
|
|
1899
|
-
const { locale } = (0, react.useContext)(ConfigContext);
|
|
1909
|
+
const { direction, locale } = (0, react.useContext)(ConfigContext);
|
|
1900
1910
|
const [hsv, setHsv] = (0, react.useState)([
|
|
1901
1911
|
0,
|
|
1902
1912
|
100,
|
|
@@ -1965,6 +1975,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1965
1975
|
}
|
|
1966
1976
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1967
1977
|
"data-u-comp": "color-picker",
|
|
1978
|
+
dir: direction,
|
|
1968
1979
|
className: "univer-cursor-default univer-space-y-2 univer-rounded-lg",
|
|
1969
1980
|
onClick: (e) => e.stopPropagation(),
|
|
1970
1981
|
children: [
|
|
@@ -1985,7 +1996,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1985
1996
|
})
|
|
1986
1997
|
}),
|
|
1987
1998
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog, {
|
|
1988
|
-
className: "!univer-w-fit !univer-p-2.5",
|
|
1999
|
+
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
1989
2000
|
closable: false,
|
|
1990
2001
|
maskClosable: false,
|
|
1991
2002
|
open: visible,
|
|
@@ -2615,6 +2626,7 @@ const inputVariants = (0, class_variance_authority.cva)("univer-box-border unive
|
|
|
2615
2626
|
defaultVariants: { size: "small" }
|
|
2616
2627
|
});
|
|
2617
2628
|
const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type = "text", placeholder, value, size = "small", allowClear = false, disabled = false, onClick, onKeyDown, onChange, onFocus, onBlur, slot, inputClass, inputStyle, ...props }, ref) => {
|
|
2629
|
+
const { direction } = (0, react.useContext)(ConfigContext);
|
|
2618
2630
|
const handleClear = (e) => {
|
|
2619
2631
|
e.stopPropagation();
|
|
2620
2632
|
onChange === null || onChange === void 0 || onChange("");
|
|
@@ -2649,6 +2661,10 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2649
2661
|
(0, react.useEffect)(() => {
|
|
2650
2662
|
if (allowClear && !(slot && slotRef.current)) setPaddingRight(26);
|
|
2651
2663
|
}, []);
|
|
2664
|
+
const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : {
|
|
2665
|
+
...inputStyle,
|
|
2666
|
+
paddingRight
|
|
2667
|
+
};
|
|
2652
2668
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2653
2669
|
"data-u-comp": "input",
|
|
2654
2670
|
className: clsx$1("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md", disabled && "univer-cursor-not-allowed", className),
|
|
@@ -2666,10 +2682,7 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2666
2682
|
onChange: handleChange,
|
|
2667
2683
|
onFocus,
|
|
2668
2684
|
onBlur,
|
|
2669
|
-
style:
|
|
2670
|
-
...inputStyle,
|
|
2671
|
-
paddingRight
|
|
2672
|
-
},
|
|
2685
|
+
style: mergedInputStyle,
|
|
2673
2686
|
...props
|
|
2674
2687
|
}), hasSlotContent && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2675
2688
|
className: "univer-absolute univer-right-2 univer-flex univer-items-center univer-gap-1 univer-rounded-full",
|
package/lib/es/index.js
CHANGED
|
@@ -167,32 +167,6 @@ const Button = forwardRef(({ className, variant, size, asChild = false, ...props
|
|
|
167
167
|
});
|
|
168
168
|
Button.displayName = "Button";
|
|
169
169
|
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/components/button/ButtonGroup.tsx
|
|
172
|
-
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
173
|
-
const totalButtons = Children.count(children);
|
|
174
|
-
const isHorizontal = orientation === "horizontal";
|
|
175
|
-
const isVertical = orientation === "vertical";
|
|
176
|
-
return /* @__PURE__ */ jsx("div", {
|
|
177
|
-
className: clsx("univer-grid", {
|
|
178
|
-
"univer-grid-flow-row": isVertical,
|
|
179
|
-
"univer-w-fit": isVertical
|
|
180
|
-
}, className),
|
|
181
|
-
children: Children.map(children, (child, index) => {
|
|
182
|
-
const isFirst = index === 0;
|
|
183
|
-
const isLast = index === totalButtons - 1;
|
|
184
|
-
return cloneElement(child, { className: clsx({
|
|
185
|
-
"!univer-rounded-l-none": isHorizontal && !isFirst,
|
|
186
|
-
"!univer-rounded-r-none": isHorizontal && !isLast,
|
|
187
|
-
"!univer-border-l-0": isHorizontal && !isFirst,
|
|
188
|
-
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
189
|
-
"!univer-rounded-b-none": isVertical && !isLast,
|
|
190
|
-
"!univer-border-t-0": isVertical && !isFirst
|
|
191
|
-
}, child.props.className) });
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
|
|
196
170
|
//#endregion
|
|
197
171
|
//#region src/helper/is-browser.ts
|
|
198
172
|
/**
|
|
@@ -239,6 +213,35 @@ function ConfigProvider(props) {
|
|
|
239
213
|
});
|
|
240
214
|
}
|
|
241
215
|
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/components/button/ButtonGroup.tsx
|
|
218
|
+
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
219
|
+
const { direction } = useContext(ConfigContext);
|
|
220
|
+
const totalButtons = Children.count(children);
|
|
221
|
+
const isHorizontal = orientation === "horizontal";
|
|
222
|
+
const isVertical = orientation === "vertical";
|
|
223
|
+
const isRtl = direction === "rtl";
|
|
224
|
+
return /* @__PURE__ */ jsx("div", {
|
|
225
|
+
className: clsx("univer-grid", {
|
|
226
|
+
"univer-grid-flow-row": isVertical,
|
|
227
|
+
"univer-w-fit": isVertical
|
|
228
|
+
}, className),
|
|
229
|
+
children: Children.map(children, (child, index) => {
|
|
230
|
+
const isFirst = index === 0;
|
|
231
|
+
const isLast = index === totalButtons - 1;
|
|
232
|
+
return cloneElement(child, { className: clsx({
|
|
233
|
+
"!univer-rounded-l-none": isHorizontal && (isRtl ? !isLast : !isFirst),
|
|
234
|
+
"!univer-rounded-r-none": isHorizontal && (isRtl ? !isFirst : !isLast),
|
|
235
|
+
"!univer-border-l-0": isHorizontal && !isRtl && !isFirst,
|
|
236
|
+
"!univer-border-r-0": isHorizontal && isRtl && !isFirst,
|
|
237
|
+
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
238
|
+
"!univer-rounded-b-none": isVertical && !isLast,
|
|
239
|
+
"!univer-border-t-0": isVertical && !isFirst
|
|
240
|
+
}, child.props.className) });
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
|
|
242
245
|
//#endregion
|
|
243
246
|
//#region src/helper/class-utilities.ts
|
|
244
247
|
/**
|
|
@@ -978,22 +981,27 @@ const DialogOverlay = forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
978
981
|
...props
|
|
979
982
|
}));
|
|
980
983
|
DialogOverlay.displayName = Overlay.displayName;
|
|
981
|
-
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
className: "univer-
|
|
990
|
-
|
|
984
|
+
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
985
|
+
container: mountContainer !== null && mountContainer !== void 0 ? mountContainer : void 0,
|
|
986
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Content$2, {
|
|
987
|
+
ref,
|
|
988
|
+
className: clsx("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=open]:univer-slide-in-from-left-1/2 data-[state=open]:univer-slide-in-from-top-[48%] data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[state=closed]:univer-slide-out-to-left-1/2 data-[state=closed]:univer-slide-out-to-top-[48%] univer-fixed univer-left-1/2 univer-top-1/2 univer-z-[1080] univer-box-border univer-grid univer-w-full univer-max-w-lg -univer-translate-x-1/2 -univer-translate-y-1/2 univer-gap-4 univer-bg-white univer-p-4 univer-text-gray-500 univer-shadow-md univer-duration-200 sm:!univer-rounded-lg dark:!univer-bg-gray-700 dark:!univer-text-gray-400", borderClassName, className),
|
|
989
|
+
...props,
|
|
990
|
+
children: [children, closable && /* @__PURE__ */ jsxs(Close, {
|
|
991
|
+
"data-slot": "close",
|
|
992
|
+
className: "univer-absolute univer-right-4 univer-top-4 univer-size-6 univer-cursor-pointer univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-transition-opacity hover:univer-opacity-100 disabled:univer-pointer-events-none rtl:univer-left-4 rtl:univer-right-auto",
|
|
993
|
+
onClick: onClickClose,
|
|
994
|
+
children: [/* @__PURE__ */ jsx(CloseIcon, { className: "univer-size-4 univer-text-gray-400" }), /* @__PURE__ */ jsx("span", {
|
|
995
|
+
className: "univer-sr-only",
|
|
996
|
+
children: "Close"
|
|
997
|
+
})]
|
|
991
998
|
})]
|
|
992
999
|
})]
|
|
993
|
-
})
|
|
1000
|
+
}));
|
|
994
1001
|
DialogContent.displayName = Content$2.displayName;
|
|
995
1002
|
const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
996
|
-
|
|
1003
|
+
"data-slot": "dialog-header",
|
|
1004
|
+
className: clsx("univer-flex univer-flex-col univer-space-y-1.5 univer-text-center sm:!univer-text-left sm:rtl:!univer-text-right", className),
|
|
997
1005
|
...props
|
|
998
1006
|
});
|
|
999
1007
|
DialogHeader.displayName = "DialogHeader";
|
|
@@ -1136,7 +1144,7 @@ function useDraggable(options = {}) {
|
|
|
1136
1144
|
function Dialog(props) {
|
|
1137
1145
|
var _locale$Confirm$cance, _locale$Confirm, _locale$Confirm$confi, _locale$Confirm2;
|
|
1138
1146
|
const { className, children, style, open = false, title, width, draggable = false, defaultPosition, footer: propFooter, mask = true, keyboard = true, closable = true, maskClosable = true, showOk, showCancel, onOpenChange, onClose, onOk, onCancel } = props;
|
|
1139
|
-
const { locale } = useContext(ConfigContext);
|
|
1147
|
+
const { locale, mountContainer, direction } = useContext(ConfigContext);
|
|
1140
1148
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1141
1149
|
defaultPosition,
|
|
1142
1150
|
enabled: draggable
|
|
@@ -1186,6 +1194,8 @@ function Dialog(props) {
|
|
|
1186
1194
|
} : {}
|
|
1187
1195
|
},
|
|
1188
1196
|
closable,
|
|
1197
|
+
mountContainer,
|
|
1198
|
+
dir: direction,
|
|
1189
1199
|
onClickClose: handleClickClose,
|
|
1190
1200
|
onEscapeKeyDown: (e) => {
|
|
1191
1201
|
if (keyboard) handleClickClose();
|
|
@@ -1452,14 +1462,14 @@ function HexInput({ hsv, onChange }) {
|
|
|
1452
1462
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1453
1463
|
};
|
|
1454
1464
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
1455
|
-
className: clsx("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-text-white", borderClassName),
|
|
1465
|
+
className: clsx("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none rtl:!univer-pl-2 rtl:!univer-pr-4 dark:!univer-text-white", borderClassName),
|
|
1456
1466
|
value: inputValue,
|
|
1457
1467
|
onChange: handleChange,
|
|
1458
1468
|
onBlur: handleBlur,
|
|
1459
1469
|
maxLength: 6,
|
|
1460
1470
|
spellCheck: false
|
|
1461
1471
|
}), /* @__PURE__ */ jsx("span", {
|
|
1462
|
-
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400",
|
|
1472
|
+
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400 rtl:univer-left-auto rtl:univer-right-1.5",
|
|
1463
1473
|
children: "#"
|
|
1464
1474
|
})] });
|
|
1465
1475
|
}
|
|
@@ -1895,7 +1905,7 @@ const MemoizedColorInput = memo(ColorInput);
|
|
|
1895
1905
|
const MemoizedColorPresets = memo(ColorPresets);
|
|
1896
1906
|
function ColorPicker({ format = "hex", value, onChange }) {
|
|
1897
1907
|
if (!isBrowser) return null;
|
|
1898
|
-
const { locale } = useContext(ConfigContext);
|
|
1908
|
+
const { direction, locale } = useContext(ConfigContext);
|
|
1899
1909
|
const [hsv, setHsv] = useState([
|
|
1900
1910
|
0,
|
|
1901
1911
|
100,
|
|
@@ -1964,6 +1974,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1964
1974
|
}
|
|
1965
1975
|
return /* @__PURE__ */ jsxs("div", {
|
|
1966
1976
|
"data-u-comp": "color-picker",
|
|
1977
|
+
dir: direction,
|
|
1967
1978
|
className: "univer-cursor-default univer-space-y-2 univer-rounded-lg",
|
|
1968
1979
|
onClick: (e) => e.stopPropagation(),
|
|
1969
1980
|
children: [
|
|
@@ -1984,7 +1995,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1984
1995
|
})
|
|
1985
1996
|
}),
|
|
1986
1997
|
/* @__PURE__ */ jsx(Dialog, {
|
|
1987
|
-
className: "!univer-w-fit !univer-p-2.5",
|
|
1998
|
+
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
1988
1999
|
closable: false,
|
|
1989
2000
|
maskClosable: false,
|
|
1990
2001
|
open: visible,
|
|
@@ -2614,6 +2625,7 @@ const inputVariants = cva$1("univer-box-border univer-w-full univer-rounded-md u
|
|
|
2614
2625
|
defaultVariants: { size: "small" }
|
|
2615
2626
|
});
|
|
2616
2627
|
const Input = forwardRef(({ autoFocus = false, className, style, type = "text", placeholder, value, size = "small", allowClear = false, disabled = false, onClick, onKeyDown, onChange, onFocus, onBlur, slot, inputClass, inputStyle, ...props }, ref) => {
|
|
2628
|
+
const { direction } = useContext(ConfigContext);
|
|
2617
2629
|
const handleClear = (e) => {
|
|
2618
2630
|
e.stopPropagation();
|
|
2619
2631
|
onChange === null || onChange === void 0 || onChange("");
|
|
@@ -2648,6 +2660,10 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2648
2660
|
useEffect(() => {
|
|
2649
2661
|
if (allowClear && !(slot && slotRef.current)) setPaddingRight(26);
|
|
2650
2662
|
}, []);
|
|
2663
|
+
const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : {
|
|
2664
|
+
...inputStyle,
|
|
2665
|
+
paddingRight
|
|
2666
|
+
};
|
|
2651
2667
|
return /* @__PURE__ */ jsxs("div", {
|
|
2652
2668
|
"data-u-comp": "input",
|
|
2653
2669
|
className: clsx("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md", disabled && "univer-cursor-not-allowed", className),
|
|
@@ -2665,10 +2681,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2665
2681
|
onChange: handleChange,
|
|
2666
2682
|
onFocus,
|
|
2667
2683
|
onBlur,
|
|
2668
|
-
style:
|
|
2669
|
-
...inputStyle,
|
|
2670
|
-
paddingRight
|
|
2671
|
-
},
|
|
2684
|
+
style: mergedInputStyle,
|
|
2672
2685
|
...props
|
|
2673
2686
|
}), hasSlotContent && /* @__PURE__ */ jsxs("div", {
|
|
2674
2687
|
className: "univer-absolute univer-right-2 univer-flex univer-items-center univer-gap-1 univer-rounded-full",
|
package/lib/index.css
CHANGED
|
@@ -179,6 +179,10 @@
|
|
|
179
179
|
top: 1px;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
.\!univer-z-\[1090\] {
|
|
183
|
+
z-index: 1090 !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
182
186
|
.univer-z-0 {
|
|
183
187
|
z-index: 0;
|
|
184
188
|
}
|
|
@@ -945,6 +949,10 @@
|
|
|
945
949
|
border-left-width: 0 !important;
|
|
946
950
|
}
|
|
947
951
|
|
|
952
|
+
.\!univer-border-r-0 {
|
|
953
|
+
border-right-width: 0 !important;
|
|
954
|
+
}
|
|
955
|
+
|
|
948
956
|
.\!univer-border-t-0 {
|
|
949
957
|
border-top-width: 0 !important;
|
|
950
958
|
}
|
|
@@ -2169,10 +2177,22 @@
|
|
|
2169
2177
|
}
|
|
2170
2178
|
}
|
|
2171
2179
|
|
|
2180
|
+
.rtl\:univer-left-4:where([dir="rtl"], [dir="rtl"] *) {
|
|
2181
|
+
left: 1rem;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
.rtl\:univer-left-auto:where([dir="rtl"], [dir="rtl"] *) {
|
|
2185
|
+
left: auto;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2172
2188
|
.rtl\:univer-left-px:where([dir="rtl"], [dir="rtl"] *) {
|
|
2173
2189
|
left: 1px;
|
|
2174
2190
|
}
|
|
2175
2191
|
|
|
2192
|
+
.rtl\:univer-right-1\.5:where([dir="rtl"], [dir="rtl"] *) {
|
|
2193
|
+
right: .375rem;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2176
2196
|
.rtl\:univer-right-auto:where([dir="rtl"], [dir="rtl"] *) {
|
|
2177
2197
|
right: auto;
|
|
2178
2198
|
}
|
|
@@ -2195,6 +2215,20 @@
|
|
|
2195
2215
|
border-right-width: 1px;
|
|
2196
2216
|
}
|
|
2197
2217
|
|
|
2218
|
+
.rtl\:\!univer-pl-2:where([dir="rtl"], [dir="rtl"] *) {
|
|
2219
|
+
padding-left: .5rem !important;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
.rtl\:\!univer-pr-4:where([dir="rtl"], [dir="rtl"] *) {
|
|
2223
|
+
padding-right: 1rem !important;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
@media (min-width: 640px) {
|
|
2227
|
+
.sm\:rtl\:\!univer-text-right:where([dir="rtl"], [dir="rtl"] *) {
|
|
2228
|
+
text-align: right !important;
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2198
2232
|
.dark\:\!univer-divide-gray-600:where(.univer-dark, .univer-dark *) > :not([hidden]) ~ :not([hidden]) {
|
|
2199
2233
|
border-color: var(--univer-gray-600) !important;
|
|
2200
2234
|
}
|