Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: update dark mode styles for consistency in RangeLoading and ConditionalStyleEditor components (#5276)
白熱77b37a5fd3cf
diff --git a/packages-experimental/debugger/src/components/RangeLoading.tsx b/packages-experimental/debugger/src/components/RangeLoading.tsxindex 62d4b2b4b8..e5d786213a 100644--- a/packages-experimental/debugger/src/components/RangeLoading.tsx+++ b/packages-experimental/debugger/src/components/RangeLoading.tsx@@ -22,7 +22,7 @@ export const RangeLoading = () => {className={clsx(`univer-flex univer-size-full univer-origin-top-left univer-items-center univer-justify-centeruniver-bg-white- dark:univer-bg-gray-900+ dark:!univer-bg-gray-900`, borderClassName)}>Loading...diff --git a/packages-experimental/uni-formula-ui/src/views/components/DocFormulaPopup.tsx b/packages-experimental/uni-formula-ui/src/views/components/DocFormulaPopup.tsxindex eb79f6e491..8b3171629d 100644--- a/packages-experimental/uni-formula-ui/src/views/components/DocFormulaPopup.tsx+++ b/packages-experimental/uni-formula-ui/src/views/components/DocFormulaPopup.tsx@@ -141,23 +141,6 @@ function DocFormula(props: { popupInfo: IUniFormulaPopupInfo }) {onMouseEnter={() => onHovered(true)}onMouseLeave={() => onHovered(false)}>- {/* TODO@wzhudev: fix DocFormulaFloat */}- {/* <TextEditor- id={UNI_FORMULA_EDITOR_ID}- className={clsx(styles.docUiFormulaPopupEditor, focused && styles.docUiFormulaPopupEditorActivated)}- placeholder={localeService.t('uni-formula.popup.placeholder')}- snapshot={snapshotRef.current}- cancelDefaultResizeListener- value={f ?? ''}- isSingle- isFormulaEditor- onChange={(str) => onFormulaStringChange(str ?? '')}- onFocus={() => {- formulaPopupService.lockPopup();- setFocused(true);- }}- onBlur={() => setFocused(false)}- /> */}<div className="univer-flex"><spanclassName="univer-flex univer-items-center univer-gap-2 univer-rounded-lg univer-p-1"diff --git a/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx b/packages-experimental/uniui/src/views/uni-controls/UniControls.tsxindex 989e0635c0..83ae322e8f 100644--- a/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx+++ b/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx@@ -147,19 +147,13 @@ export const UniControls = ({ zoom, onItemClick }: { zoom: number; onItemClick?:{shortcuts?.map((item) => (<akey={item}- className={clsx(- `- univer-relative univer-box-border univer-cursor-pointer univer-py-1 univer-pl-9- univer-text-gray-900- dark:!univer-text-white- `,- `- univer-rounded univer-no-underline univer-transition-colors univer-duration-200- dark:hover:!univer-bg-gray-700- hover:univer-bg-gray-100- `,- item === zoomPercent ? 'univer-bg-gray-100' : ''- )}+ className={clsx(`+ univer-relative univer-box-border univer-cursor-pointer univer-rounded univer-py-1+ univer-pl-9 univer-text-gray-900 univer-no-underline univer-transition-colors+ univer-duration-200+ dark:!univer-text-white dark:hover:!univer-bg-gray-700+ hover:univer-bg-gray-100+ `, item === zoomPercent ? 'univer-bg-gray-100' : '')}onClick={() => onZoomMenuChange(item)}>{item === zoomPercent && (@@ -181,15 +175,13 @@ export const UniControls = ({ zoom, onItemClick }: { zoom: number; onItemClick?:)}><a- className={clsx(- `- univer-h-7 univer-w-[55px] univer-cursor-pointer univer-rounded univer-text-center- univer-text-xs univer-leading-loose univer-text-gray-700 univer-no-underline- univer-transition-all univer-duration-200- group-data-[open=true]:univer-bg-gray-200- hover:univer-bg-gray-200- `- )}+ className={`+ univer-h-7 univer-w-[55px] univer-cursor-pointer univer-rounded univer-text-center univer-text-xs+ univer-leading-loose univer-text-gray-700 univer-no-underline univer-transition-all+ univer-duration-200+ group-data-[open=true]:univer-bg-gray-200+ hover:univer-bg-gray-200+ `}>{zoomPercent}%diff --git a/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx b/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsxindex a03cbc6048..4fe5ef0419 100644--- a/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx+++ b/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx@@ -195,7 +195,11 @@ export function FormulaBar() {univer-box-border univer-flex univer-h-full univer-w-full univer-items-center univer-gap-2 univer-p-2`}>- <div className={clsx('univer-flex univer-univer-grow-0 univer-shrink-0 univer-px-1.5', { 'univer-cursor-not-allowed univer-text-gray-200': disable })}>+ <div+ className={clsx('univer-flex univer-univer-grow-0 univer-shrink-0 univer-px-1.5', {+ 'univer-cursor-not-allowed univer-text-gray-200': disable,+ })}+ ><Button size="small" variant="text" className="univer-text-red-600" onClick={handleCloseBtnClick}><CloseSingle /></Button>diff --git a/packages/design/src/components/accordion/Accordion.tsx b/packages/design/src/components/accordion/Accordion.tsxindex 961ec9e1d3..c479eeba0c 100644--- a/packages/design/src/components/accordion/Accordion.tsx+++ b/packages/design/src/components/accordion/Accordion.tsx@@ -68,15 +68,13 @@ export function Accordion(props: IAccordionProps) {<span className="univer-font-medium">{item.label}</span></button><div- className={clsx(- `- univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500- univer-ease-in-out- `,- openIndex === index- ? 'univer-max-h-screen'- : 'univer-max-h-0'- )}+ className={clsx(`+ univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500+ univer-ease-in-out+ `, {+ 'univer-max-h-screen': openIndex === index,+ 'univer-max-h-0': openIndex !== index,+ })}><div className="univer-box-border univer-px-4 univer-py-1.5">{item.children}</div></div>diff --git a/packages/design/src/components/avatar/Avatar.tsx b/packages/design/src/components/avatar/Avatar.tsxindex 6f7411ecf4..f9ab718f9c 100644--- a/packages/design/src/components/avatar/Avatar.tsx+++ b/packages/design/src/components/avatar/Avatar.tsx@@ -14,14 +14,41 @@* limitations under the License.*/+import type { VariantProps } from 'class-variance-authority';import type { CSSProperties, ReactNode } from 'react';+import { cva } from 'class-variance-authority';import { clsx } from '../../helper/clsx';-type Shape = 'circle' | 'square';-type AvatarSize = number | 'middle' | 'small';type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';-export interface IAvatarProps {+const avatarVariants = cva(+ `+ univer-relative univer-inline-block univer-overflow-hidden univer-whitespace-nowrap univer-bg-gray-200+ univer-text-center univer-align-middle univer-text-white+ `,+ {+ variants: {+ /**+ * The shape of the avatar+ * @default 'circle'+ */+ shape: {+ circle: 'univer-rounded-full',+ square: 'univer-rounded',+ },+ size: {+ middle: 'univer-size-9 univer-leading-9',+ small: 'univer-size-7 univer-leading-7',+ },+ },+ defaultVariants: {+ shape: 'circle',+ size: 'middle',+ },+ }+);++export interface IAvatarProps extends Omit<VariantProps<typeof avatarVariants>, 'size'> {children?: ReactNode;className?: string;@@ -35,17 +62,11 @@ export interface IAvatarProps {/** Image description */alt?: string;- /**- * The shape of the avatar- * @default 'circle'- */- shape?: Shape;-/*** The size of the avatar* @default 'middle'*/- size?: AvatarSize;+ size?: 'small' | 'middle' | number;/** The address of the image for an image avatar or image element */src?: string;@@ -90,25 +111,23 @@ export function Avatar(props: IAvatarProps) {}: {};- const _className = clsx(`- univer-relative univer-inline-block univer-overflow-hidden univer-whitespace-nowrap univer-bg-gray-200- univer-text-center univer-align-middle univer-text-white- `, {- 'univer-rounded-full': shape === 'circle',- 'univer-rounded': shape === 'square',- 'univer-bg-transparent': src,- 'univer-size-9 univer-leading-9': size === 'middle',- 'univer-size-7 univer-leading-7': size === 'small',- }, className);-const fitStyle = { objectFit: fit };- if (src) {- return (- <span- className={_className}- style={{ ...sizeStyle, ...style, ...fitStyle }}- >+ return (+ <span+ className={clsx(avatarVariants({+ shape,+ size: typeof size === 'number' ? 'middle' : size,+ }), {+ 'univer-bg-transparent': src,+ }, className)}+ style={{+ ...sizeStyle,+ ...style,+ ...(src && fitStyle),+ }}+ >+ {src && (<imgclassName="univer-block univer-size-full"src={src}@@ -117,13 +136,7 @@ export function Avatar(props: IAvatarProps) {onError={onError}onLoad={onLoad}/>- {children}- </span>- );- }-- return (- <span className={_className} style={{ ...sizeStyle, ...style }}>+ )}{children}</span>);diff --git a/packages/sheets-conditional-formatting-ui/src/components/conditional-style-editor/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/conditional-style-editor/index.tsxindex f0e896d7f1..d4fdc7f268 100644--- a/packages/sheets-conditional-formatting-ui/src/components/conditional-style-editor/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/conditional-style-editor/index.tsx@@ -105,7 +105,7 @@ export const ConditionalStyleEditor = (props: IConditionalStyleEditorProps) => {<div className={clsx('univer-my-2.5 univer-flex univer-justify-between', className)}><divclassName={clsx(buttonItemClassName, {- 'univer-bg-gray-100 dark:univer-bg-gray-700': getBooleanFromNumber(isBold || BooleanNumber.FALSE),+ 'univer-bg-gray-100 dark:!univer-bg-gray-700': getBooleanFromNumber(isBold || BooleanNumber.FALSE),})}onClick={() => setIsBold(getAnotherBooleanNumber(isBold))}>@@ -113,7 +113,7 @@ export const ConditionalStyleEditor = (props: IConditionalStyleEditorProps) => {</div><divclassName={clsx(buttonItemClassName, {- 'univer-bg-gray-100 dark:univer-bg-gray-700': getBooleanFromNumber(isItalic || BooleanNumber.FALSE),+ 'univer-bg-gray-100 dark:!univer-bg-gray-700': getBooleanFromNumber(isItalic || BooleanNumber.FALSE),})}onClick={() => setIsItalic(getAnotherBooleanNumber(isItalic))}>@@ -121,7 +121,7 @@ export const ConditionalStyleEditor = (props: IConditionalStyleEditorProps) => {</div><divclassName={clsx(buttonItemClassName, {- 'univer-bg-gray-100 dark:univer-bg-gray-700': getBooleanFromNumber(isUnderline || BooleanNumber.FALSE),+ 'univer-bg-gray-100 dark:!univer-bg-gray-700': getBooleanFromNumber(isUnderline || BooleanNumber.FALSE),})}onClick={() => setIsUnderline(getAnotherBooleanNumber(isUnderline))}>@@ -129,7 +129,7 @@ export const ConditionalStyleEditor = (props: IConditionalStyleEditorProps) => {</div><divclassName={clsx(buttonItemClassName, {- 'univer-bg-gray-100 dark:univer-bg-gray-700': getBooleanFromNumber(isStrikethrough || BooleanNumber.FALSE),+ 'univer-bg-gray-100 dark:!univer-bg-gray-700': getBooleanFromNumber(isStrikethrough || BooleanNumber.FALSE),})}onClick={() => setIsStrikethrough(getAnotherBooleanNumber(isStrikethrough))}>diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsxindex bc391f3122..0901c2d061 100644--- a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx@@ -30,7 +30,7 @@ import { HyperLinkEditSourceType } from '../../types/enums/edit-source';const iconsMap = {[SheetHyperLinkType.URL]: <LinkSingle />,- [SheetHyperLinkType.SHEET]: <Xlsx />,+ [SheetHyperLinkType.SHEET]: <Xlsx className="univer-text-green-500" />,[SheetHyperLinkType.RANGE]: <AllBorderSingle />,[SheetHyperLinkType.DEFINE_NAME]: <AllBorderSingle />,[SheetHyperLinkType.INVALID]: <AllBorderSingle />,diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsxindex b105f5c297..26189d255b 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx@@ -58,17 +58,15 @@ export function SheetBarItem(props: IBaseSheetBarProps) {data-id={sheetId}className={clsx(`univer-mx-1 univer-box-border univer-flex univer-flex-grow univer-cursor-pointer univer-select-none- univer-flex-row univer-items-center univer-rounded univer-text-xs univer-text-gray-900- univer-transition-colors+ univer-flex-row univer-items-center univer-rounded univer-text-xs univer-transition-[colors,box-shadow]dark:!univer-text-white`, currentSelected? `- univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700 univer-shadow-sm- univer-transition-shadow+ univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700 univer-shadowdark:!univer-bg-gray-900`: `- univer-font-medium+ univer-font-medium univer-text-gray-900dark:hover:!univer-bg-gray-700hover:univer-bg-gray-100`)}diff --git a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsxindex dc9b660d0f..292f922999 100644--- a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx+++ b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx@@ -157,13 +157,12 @@ export const ThreadCommentEditor = forwardRef<IThreadCommentEditorInstance, IThrexport const ThreadCommentSuggestion = ({ active, user }: { active: boolean; user: IUser }) => (<div- className={clsx(- `- univer-flex univer-items-center univer-text-sm univer-text-gray-900- dark:!univer-text-white- `,- { 'univer-bg-gray-50 dark:!univer-bg-gray-900': active }- )}+ className={clsx(`+ univer-flex univer-items-center univer-text-sm univer-text-gray-900+ dark:!univer-text-white+ `, {+ 'univer-bg-gray-50 dark:!univer-bg-gray-900': active,+ })}><imgclassName="univer-mr-1.5 univer-h-6 univer-w-6 univer-rounded-full"diff --git a/packages/thread-comment-ui/src/views/thread-comment-tree/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-tree/index.tsxindex 0937339548..9f7e00f9f9 100644--- a/packages/thread-comment-ui/src/views/thread-comment-tree/index.tsx+++ b/packages/thread-comment-ui/src/views/thread-comment-tree/index.tsx@@ -407,17 +407,14 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {{!!comments && (<div className="univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row"><div- className={clsx(- `- univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer- univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base- dark:hover:!univer-bg-gray-800- hover:univer-bg-gray-50- `,- {- 'univer-text-green-500': resolved,- }- )}+ className={clsx(`+ univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer+ univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base+ dark:hover:!univer-bg-gray-800+ hover:univer-bg-gray-50+ `, {+ 'univer-text-green-500': resolved,+ })}onClick={handleResolve}>{resolved ? <ResolvedSingle /> : <SolveSingle />}