Skip to content

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.

refactor(*): refactor Select component (#5117)

白熱20b094f420b5
diff --git a/common/shared/tailwind/tailwind.config.ts b/common/shared/tailwind/tailwind.config.ts
index 6ce375b55c..1208cb2460 100644
--- a/common/shared/tailwind/tailwind.config.ts
+++ b/common/shared/tailwind/tailwind.config.ts
@@ -43,13 +43,13 @@ const config: Omit<Config, 'content'> = {
50: '#F9FAFB',
100: '#EEEFF1',
200: '#E3E5EA',
- 300: '#CDD0D8',
- 400: '#979DAC',
- 500: '#5F6574',
- 600: '#414657',
- 700: '#2C3040',
- 800: '#181C2A',
- 900: '#0E111E',
+ 300: '#A8B0BD',
+ 400: '#7D8698',
+ 500: '#4E5565',
+ 600: '#31363F',
+ 700: '#272A2F',
+ 800: '#1F2124',
+ 900: '#1B1C1F',
},
blue: {
50: '#EBF5FF',
diff --git a/examples/src/main.tsx b/examples/src/main.tsx
index 2e4a5a13c9..e328ef6a06 100644
--- a/examples/src/main.tsx
+++ b/examples/src/main.tsx
@@ -97,7 +97,7 @@ function Examples() {
<a
key={demo.title}
className={`
- univer-rounded-lg univer-bg-blue-500 univer-px-6 univer-py-2.5 univer-font-medium
+ univer-rounded-lg univer-bg-primary-500 univer-px-6 univer-py-2.5 univer-font-medium
univer-text-white univer-no-underline univer-shadow-sm univer-transition-all
univer-duration-300 univer-ease-in-out
hover:univer-scale-105 hover:univer-bg-emerald-500
diff --git a/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx b/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx
index fd8fcaf2cc..4f9b677d38 100644
--- a/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx
+++ b/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx
@@ -49,7 +49,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.fontSize')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.fontSize}
max={72}
min={12}
@@ -64,7 +63,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.direction')}</div>
<Select
- className="univer-box-border univer-h-7"
value={config.direction}
options={[
{ label: localeService.t('univer-watermark.ltr'), value: 'ltr' },
@@ -77,7 +75,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.opacity')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
max={1}
min={0}
step={0.05}
@@ -136,7 +133,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-flex-1 univer-gap-1">
<div>{localeService.t('univer-watermark.rotate')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.rotate}
max={360}
min={-360}
@@ -160,7 +156,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.spacingX')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.spacingX}
min={0}
onChange={(val) => {
@@ -174,7 +169,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.spacingY')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.spacingY}
min={0}
onChange={(val) => {
@@ -190,7 +184,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.startX')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.x}
min={0}
onChange={(val) => {
@@ -204,7 +197,6 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {
<div className="univer-grid univer-gap-1">
<div>{localeService.t('univer-watermark.startY')}</div>
<InputNumber
- className="univer-box-border univer-h-7"
value={config.y}
min={0}
onChange={(val) => {
diff --git a/packages/design/package.json b/packages/design/package.json
index 881f15aefa..7fdfb8fc48 100644
--- a/packages/design/package.json
+++ b/packages/design/package.json
@@ -68,7 +68,7 @@
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
},
"dependencies": {
- "@radix-ui/react-dialog": "^1.1.1 ",
+ "@radix-ui/react-dialog": "^1.1.11",
"@radix-ui/react-dropdown-menu": "^2.1.12",
"@radix-ui/react-popover": "^1.1.11",
"@radix-ui/react-separator": "^1.1.4",
diff --git a/packages/design/src/components/color-picker/ColorInput.tsx b/packages/design/src/components/color-picker/ColorInput.tsx
index addefe17f8..5ae439aff0 100644
--- a/packages/design/src/components/color-picker/ColorInput.tsx
+++ b/packages/design/src/components/color-picker/ColorInput.tsx
@@ -74,7 +74,7 @@ function HexInput({ hsv, onChange }: IInputProps) {
<input
className={`
univer-w-full univer-px-2 !univer-pl-4 univer-uppercase
- focus:univer-border-blue-500 focus:univer-outline-none
+ focus:univer-border-primary-500 focus:univer-outline-none
`}
value={inputValue}
onChange={handleChange}
diff --git a/packages/design/src/components/color-picker/__tests__/__snapshots__/index.spec.tsx.snap b/packages/design/src/components/color-picker/__tests__/__snapshots__/index.spec.tsx.snap
index 14f2f52ca0..75d8b6460b 100644
--- a/packages/design/src/components/color-picker/__tests__/__snapshots__/index.spec.tsx.snap
+++ b/packages/design/src/components/color-picker/__tests__/__snapshots__/index.spec.tsx.snap
@@ -89,7 +89,7 @@ exports[`ColorPicker > should render correctly 1`] = `
<input
class="
univer-w-full univer-px-2 !univer-pl-4 univer-uppercase
- focus:univer-border-blue-500 focus:univer-outline-none
+ focus:univer-border-primary-500 focus:univer-outline-none
"
maxlength="6"
spellcheck="false"
@@ -469,7 +469,7 @@ exports[`ColorPicker > should render with showAlpha 1`] = `
<input
class="
univer-w-full univer-px-2 !univer-pl-4 univer-uppercase
- focus:univer-border-blue-500 focus:univer-outline-none
+ focus:univer-border-primary-500 focus:univer-outline-none
"
maxlength="6"
spellcheck="false"
@@ -846,7 +846,7 @@ exports[`ColorPicker > should render with value 1`] = `
<input
class="
univer-w-full univer-px-2 !univer-pl-4 univer-uppercase
- focus:univer-border-blue-500 focus:univer-outline-none
+ focus:univer-border-primary-500 focus:univer-outline-none
"
maxlength="6"
spellcheck="false"
diff --git a/packages/design/src/components/dropdown-menu/DropdownMenu.tsx b/packages/design/src/components/dropdown-menu/DropdownMenu.tsx
index 4f6deb1851..fc543d760c 100644
--- a/packages/design/src/components/dropdown-menu/DropdownMenu.tsx
+++ b/packages/design/src/components/dropdown-menu/DropdownMenu.tsx
@@ -39,6 +39,7 @@ type DropdownMenu = {
type?: 'radio';
className?: string;
value: string;
+ hideIndicator?: boolean;
options: { value: string; label: ReactNode; disabled?: boolean }[];
onSelect?: (item: string) => void;
};
@@ -95,6 +96,7 @@ export function DropdownMenu(props: IDropdownMenuProps) {
key={option.value}
value={option.value}
disabled={option.disabled}
+ hideIndicator={item.hideIndicator}
>
{option.label}
</DropdownMenuRadioItem>
diff --git a/packages/design/src/components/dropdown-menu/DropdownMenuPrimitive.tsx b/packages/design/src/components/dropdown-menu/DropdownMenuPrimitive.tsx
index a097585cd6..237e7e0dbf 100644
--- a/packages/design/src/components/dropdown-menu/DropdownMenuPrimitive.tsx
+++ b/packages/design/src/components/dropdown-menu/DropdownMenuPrimitive.tsx
@@ -214,36 +214,45 @@ function DropdownMenuItem({
function DropdownMenuCheckboxItem({
className,
children,
+ hideIndicator,
checked,
...props
-}: ComponentProps<typeof CheckboxItem>) {
+}: ComponentProps<typeof CheckboxItem> & { hideIndicator?: boolean }) {
return (
<CheckboxItem
data-slot="dropdown-menu-checkbox-item"
className={clsx(
`
univer-relative univer-flex univer-cursor-default univer-select-none univer-items-center
- univer-rounded univer-py-1.5 univer-pl-8 univer-pr-2 univer-text-[13px] univer-outline-none
+ univer-rounded univer-py-1.5 univer-pr-2 univer-text-[13px] univer-outline-none
univer-transition-colors
dark:focus:univer-bg-gray-600
data-[disabled]:univer-pointer-events-none data-[disabled]:univer-opacity-50
focus:univer-bg-gray-100
`,
+ {
+ 'univer-pl-8': !hideIndicator,
+ 'univer-pl-2': hideIndicator,
+ },
className
)}
checked={checked}
{...props}
>
- <span
- className={`
- univer-absolute univer-left-2 univer-flex univer-h-3.5 univer-w-3.5 univer-items-center
- univer-justify-center
- `}
- >
- <ItemIndicator>
- <CheckMarkSingle className="univer-block univer-size-4 univer-fill-current univer-text-primary-600" />
- </ItemIndicator>
- </span>
+ {!hideIndicator && (
+ <span
+ className={`
+ univer-absolute univer-left-2 univer-flex univer-h-3.5 univer-w-3.5 univer-items-center
+ univer-justify-center
+ `}
+ >
+ <ItemIndicator>
+ <CheckMarkSingle
+ className="univer-block univer-size-4 univer-fill-current univer-text-primary-600"
+ />
+ </ItemIndicator>
+ </span>
+ )}
{children}
</CheckboxItem>
);
@@ -252,34 +261,44 @@ function DropdownMenuCheckboxItem({
function DropdownMenuRadioItem({
className,
children,
+ hideIndicator,
...props
-}: ComponentProps<typeof RadioItem>) {
+}: ComponentProps<typeof RadioItem> & { hideIndicator?: boolean }) {
return (
<RadioItem
data-slot="dropdown-menu-radio-item"
className={clsx(
`
univer-relative univer-flex univer-cursor-default univer-select-none univer-items-center
- univer-rounded univer-py-1.5 univer-pl-8 univer-pr-2 univer-text-[13px] univer-outline-none
+ univer-rounded univer-py-1.5 univer-pr-2 univer-text-[13px] univer-outline-none
univer-transition-colors
dark:focus:univer-bg-gray-600
data-[disabled]:univer-pointer-events-none data-[disabled]:univer-opacity-50
focus:univer-bg-gray-100
`,
+ {
+ 'univer-pl-8': !hideIndicator,
+ 'univer-pl-2': hideIndicator,
+ },
className
)}
{...props}
>
- <span
- className={`
- univer-absolute univer-left-2 univer-flex univer-h-3.5 univer-w-3.5 univer-items-center
- univer-justify-center
- `}
- >
- <ItemIndicator>
- <CheckMarkSingle className="univer-block univer-size-4 univer-fill-current univer-text-primary-600" />
- </ItemIndicator>
- </span>
+ {!hideIndicator && (
+ <span
+ className={`
+ univer-absolute univer-left-2 univer-flex univer-h-3.5 univer-w-3.5 univer-items-center
+ univer-justify-center
+ `}
+ >
+
+ <ItemIndicator>
+ <CheckMarkSingle
+ className="univer-block univer-size-4 univer-fill-current univer-text-primary-600"
+ />
+ </ItemIndicator>
+ </span>
+ )}
{children}
</RadioItem>
);
diff --git a/packages/design/src/components/dropdown/Dropdown.stories.tsx b/packages/design/src/components/dropdown/Dropdown.stories.tsx
index f0aa847ded..1521352fe3 100644
--- a/packages/design/src/components/dropdown/Dropdown.stories.tsx
+++ b/packages/design/src/components/dropdown/Dropdown.stories.tsx
@@ -35,7 +35,7 @@ export const Playground = {
<div className="univer-relative">
<Dropdown
overlay={(
- <div className="univer-text-blue-500">
+ <div className="univer-text-primary-500">
Hello Univer
<Dropdown
overlay={(
diff --git a/packages/design/src/components/form-layout/FormLayout.stories.tsx b/packages/design/src/components/form-layout/FormLayout.stories.tsx
index 8470a7c309..18093175f1 100644
--- a/packages/design/src/components/form-layout/FormLayout.stories.tsx
+++ b/packages/design/src/components/form-layout/FormLayout.stories.tsx
@@ -17,7 +17,7 @@
import type { Meta } from '@storybook/react';
import { Input } from '../input';
-import { Select } from '../select';
+import { Select } from '../select/Select';
import { FormLayout } from './FormLayout';
const meta: Meta = {
diff --git a/packages/design/src/components/input-number/InputNumber.tsx b/packages/design/src/components/input-number/InputNumber.tsx
index bdf03318c4..8add45ffaf 100644
--- a/packages/design/src/components/input-number/InputNumber.tsx
+++ b/packages/design/src/components/input-number/InputNumber.tsx
@@ -318,6 +318,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>(
value={inputValue}
disabled={disabled}
onChange={handleInputChange}
+ onFocus={onFocus}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
/>
diff --git a/packages/design/src/components/input/Input.tsx b/packages/design/src/components/input/Input.tsx
index 5ff91b439a..3b48817203 100644
--- a/packages/design/src/components/input/Input.tsx
+++ b/packages/design/src/components/input/Input.tsx
@@ -27,7 +27,7 @@ export const inputVariants = cva(
univer-box-border univer-w-full univer-rounded-md univer-border univer-border-solid univer-border-gray-200
univer-bg-white univer-transition-colors univer-duration-200
dark:univer-border-gray-600 dark:univer-bg-gray-700 dark:univer-text-white
- focus:univer-border-primary-500 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500/20
+ focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-600/20
placeholder:univer-text-gray-400
`,
{
diff --git a/packages/design/src/components/select/LegacySelect.tsx b/packages/design/src/components/select/LegacySelect.tsx
new file mode 100644
index 0000000000..1b35d3be15
--- /dev/null
+++ b/packages/design/src/components/select/LegacySelect.tsx
@@ -0,0 +1,126 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { LabelInValueType } from 'rc-select/lib/Select';
+import type { CSSProperties, JSXElementConstructor, ReactElement, ReactNode } from 'react';
+import { MoreDownSingle } from '@univerjs/icons';
+import RcSelect from 'rc-select';
+import { useContext } from 'react';
+import { clsx } from '../../helper/clsx';
+import { ConfigContext } from '../config-provider/ConfigProvider';
+import styles from './index.module.less';
+
+/** @deprecated */
+interface ILegacyOption {
+ label?: string | ReactNode;
+ value?: string;
+ options?: ILegacyOption[];
+}
+
+/** @deprecated */
+export interface ILegacySelectProps {
+ /**
+ * The value of select
+ */
+ value: string;
+
+ /**
+ * The options of select
+ * @default []
+ */
+ options?: ILegacyOption[];
+
+ /**
+ * The callback function that is triggered when the value is changed
+ */
+ onChange: (value: string) => void;
+
+ style?: CSSProperties;
+
+ /**
+ * Whether the borderless style is used
+ * @default false
+ */
+ borderless?: boolean;
+
+ className?: string;
+ /**
+ * select mode
+ */
+ mode?: 'combobox' | 'multiple' | 'tags' | undefined;
+
+ dropdownRender?: (
+ menu: ReactElement<any, string | JSXElementConstructor<any>>
+ ) => ReactElement<any, string | JSXElementConstructor<any>>;
+
+ labelRender?: ((props: LabelInValueType) => ReactNode) | undefined;
+
+ open?: boolean;
+
+ dropdownStyle?: CSSProperties;
+
+ onDropdownVisibleChange?: (open: boolean) => void;
+
+ disabled?: boolean;
+}
+
+/** @deprecated */
+export function LegacySelect(props: ILegacySelectProps) {
+ const {
+ value,
+ options = [],
+ onChange,
+ style,
+ className,
+ mode,
+ borderless = false,
+ dropdownRender,
+ labelRender,
+ open,
+ dropdownStyle,
+ onDropdownVisibleChange,
+ disabled,
+ } = props;
+
+ const { mountContainer, locale } = useContext(ConfigContext);
+
+ const _className = clsx(className, {
+ [styles.selectBorderless]: borderless,
+ });
+
+ return mountContainer && (
+ <RcSelect
+ mode={mode}
+ prefixCls={styles.select}
+ getPopupContainer={() => mountContainer}
+ options={options}
+ value={value}
+ menuItemSelectedIcon={null}
+ suffixIcon={<MoreDownSingle />}
+ onChange={onChange}
+ style={style}
+ className={_className}
+ dropdownRender={dropdownRender}
+ labelRender={labelRender}
+ open={open}
+ dropdownStyle={dropdownStyle}
+ dropdownClassName="univer-theme"
+ onDropdownVisibleChange={onDropdownVisibleChange}
+ notFoundContent={locale?.Select.empty}
+ disabled={disabled}
+ />
+ );
+}
diff --git a/packages/design/src/components/select/Select.stories.tsx b/packages/design/src/components/select/Select.stories.tsx
index adbf2e7a47..7480c104d9 100644
--- a/packages/design/src/components/select/Select.stories.tsx
+++ b/packages/design/src/components/select/Select.stories.tsx
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
-
-import { Select } from './Select';
import type { ISelectProps } from './Select';
+import { useState } from 'react';
+import { Select } from './Select';
const meta: Meta<typeof Select> = {
title: 'Components / Select',
@@ -45,7 +44,12 @@ export const SelectBasic = {
setValue(value as string);
}
- return <Select value={value} options={options} onChange={handleChange} />;
+ return (
+ <>
+ <Select value={value} options={options} onChange={handleChange} />
+ <Select disabled value={value} options={options} onChange={handleChange} />
+ </>
+ );
},
};
@@ -77,7 +81,14 @@ export const SelectBorderless = {
setValue(value as string);
}
- return <Select value={value} options={options} onChange={handleChange} borderless />;
+ return (
+ <Select
+ value={value}
+ options={options}
+ onChange={handleChange}
+ borderless
+ />
+ );
},
};
diff --git a/packages/design/src/components/select/Select.tsx b/packages/design/src/components/select/Select.tsx
index a7dce7765c..54d0c993da 100644
--- a/packages/design/src/components/select/Select.tsx
+++ b/packages/design/src/components/select/Select.tsx
@@ -14,14 +14,12 @@
* limitations under the License.
*/
-import type { LabelInValueType } from 'rc-select/lib/Select';
-import type { CSSProperties, JSXElementConstructor, ReactElement, ReactNode } from 'react';
+import type { ReactNode } from 'react';
+import type { IDropdownMenuProps } from '../dropdown-menu/DropdownMenu';
import { MoreDownSingle } from '@univerjs/icons';
-import RcSelect from 'rc-select';
-import { useContext } from 'react';
+import { useMemo, useState } from 'react';
import { clsx } from '../../helper/clsx';
-import { ConfigContext } from '../config-provider/ConfigProvider';
-import styles from './index.module.less';
+import { DropdownMenu } from '../dropdown-menu/DropdownMenu';
interface IOption {
label?: string | ReactNode;
@@ -30,94 +28,118 @@ interface IOption {
}
export interface ISelectProps {
+ className?: string;
+
/**
* The value of select
*/
value: string;
/**
- * The options of select
- * @default []
+ * select mode
+ * @default 'combobox'
*/
- options?: IOption[];
+ mode?: 'combobox' | 'multiple';
/**
- * The callback function that is triggered when the value is changed
+ * Whether the select is disabled
+ * @default false
*/
- onChange: (value: string) => void;
+ disabled?: boolean;
- style?: CSSProperties;
+ /**
+ * The options of select
+ * @default []
+ */
+ options?: IOption[];
/**
- * Whether the borderless style is used
+ * The style of select
* @default false
*/
borderless?: boolean;
- className?: string;
/**
- * select mode
+ * The callback function that is triggered when the value is changed
*/
- mode?: 'combobox' | 'multiple' | 'tags' | undefined;
-
- dropdownRender?: (
- menu: ReactElement<any, string | JSXElementConstructor<any>>
- ) => ReactElement<any, string | JSXElementConstructor<any>>;
-
- labelRender?: ((props: LabelInValueType) => ReactNode) | undefined;
-
- open?: boolean;
-
- dropdownStyle?: CSSProperties;
-
- onDropdownVisibleChange?: (open: boolean) => void;
-
- disabled?: boolean;
+ onChange: (value: string) => void;
}
export function Select(props: ISelectProps) {
const {
- value,
- options = [],
- onChange,
- style,
className,
+ value,
mode,
+ disabled = false,
+ options = [],
borderless = false,
- dropdownRender,
- labelRender,
- open,
- dropdownStyle,
- onDropdownVisibleChange,
- disabled,
+ onChange,
} = props;
- const { mountContainer, locale } = useContext(ConfigContext);
-
- const _className = clsx(className, {
- [styles.selectBorderless]: borderless,
- });
-
- return mountContainer && (
- <RcSelect
- mode={mode}
- prefixCls={styles.select}
- getPopupContainer={() => mountContainer}
- options={options}
- value={value}
- menuItemSelectedIcon={null}
- suffixIcon={<MoreDownSingle />}
- onChange={onChange}
- style={style}
- className={_className}
- dropdownRender={dropdownRender}
- labelRender={labelRender}
+ const [open, setOpen] = useState(false);
+
+ function handleOpenChange(open: boolean) {
+ setOpen(open);
+ }
+
+ const items: IDropdownMenuProps['items'] = useMemo(() => {
+ return [{
+ type: 'radio',
+ value,
+ hideIndicator: true,
+ options: options.map((option) => ({
+ label: option.label,
+ value: option.value!,
+ disabled: false,
+ })),
+ onSelect: (item) => {
+ onChange(item);
+ },
+ }];
+ }, [options]);
+
+ const displayValue = useMemo(() => {
+ const selectedOption = options.find((option) => option.value === value);
+ return selectedOption ? selectedOption.label : '';
+ }, [options, value]);
+
+ return (
+ <DropdownMenu
+ className="univer-w-[var(--radix-popper-anchor-width)] univer-min-w-36"
+ align="start"
open={open}
- dropdownStyle={dropdownStyle}
- dropdownClassName="univer-theme"
- onDropdownVisibleChange={onDropdownVisibleChange}
- notFoundContent={locale?.Select.empty}
+ items={items}
disabled={disabled}
- />
+ onOpenChange={handleOpenChange}
+ >
+ <div
+ className={clsx(`
+ univer-box-border univer-inline-flex univer-h-8 univer-min-w-36 univer-cursor-pointer
+ univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-border
+ univer-border-solid univer-border-gray-200 univer-bg-white univer-px-2.5 univer-transition-colors
+ univer-duration-200
+ dark:univer-border-gray-600 dark:univer-bg-gray-700 dark:univer-text-white
+ hover:univer-border-primary-600
+ `, {
+ 'univer-border-primary-600 univer-outline-none univer-ring-2 univer-ring-primary-600/20': open && !borderless,
+ 'univer-border-transparent univer-bg-transparent hover:univer-border-transparent': borderless,
+ }, className)}
+ >
+ <span
+ className={`
+ univer-truncate univer-text-sm univer-text-gray-500
+ dark:univer-text-white
+ `}
+ >
+ {displayValue}
+ </span>
+ <MoreDownSingle
+ className={`
+ univer-flex-shrink-0
+ dark:univer-text-white
+ `}
+ />
+ </div>
+ </DropdownMenu>
);
}
diff --git a/packages/design/src/components/select/index.ts b/packages/design/src/components/select/index.ts
deleted file mode 100644
index a6f5b4eace..0000000000
--- a/packages/design/src/components/select/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { type ISelectProps, Select } from './Select';
diff --git a/packages/design/src/components/tooltip/Tooltip.stories.tsx b/packages/design/src/components/tooltip/Tooltip.stories.tsx
index d5e43fb9d0..084cc6f392 100644
--- a/packages/design/src/components/tooltip/Tooltip.stories.tsx
+++ b/packages/design/src/components/tooltip/Tooltip.stories.tsx
@@ -64,7 +64,7 @@ export const Playground = {
<div>
<Tooltip title="Just a tooltip">
- <a className="rounded bg-blue-500 px-4 py-2 text-white">
+ <a className="univer-rounded univer-bg-primary-500 univer-px-4 univer-py-2 univer-text-white">
Hover me
</a>
</Tooltip>
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index 70f8f9244e..7ce6fd06aa 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -38,7 +38,8 @@ export { type IPopupProps, Popup } from './components/popup';
export { type IRadioProps, Radio } from './components/radio';
export { type IRadioGroupProps, RadioGroup } from './components/radio-group';
export { type IScrollbarProps, Scrollbar } from './components/scrollbar';
-export { type ISelectProps, Select } from './components/select';
+export { type ILegacySelectProps, LegacySelect } from './components/select/LegacySelect';
+export { type ISelectProps, Select } from './components/select/Select';
export { type ISelectListProps, SelectList } from './components/select-list';
export { Segmented } from './components/segmented';
export { type ITooltipProps, Tooltip } from './components/tooltip';
diff --git a/packages/docs-hyper-link-ui/src/views/hyper-link-popup/index.tsx b/packages/docs-hyper-link-ui/src/views/hyper-link-popup/index.tsx
index e07ed3450d..6bd7390d72 100644
--- a/packages/docs-hyper-link-ui/src/views/hyper-link-popup/index.tsx
+++ b/packages/docs-hyper-link-ui/src/views/hyper-link-popup/index.tsx
@@ -66,7 +66,7 @@ export const DocLinkPopup = () => {
<div
className={`
univer-mr-2 univer-flex univer-size-5 univer-flex-[0_0_auto] univer-items-center
- univer-justify-center univer-text-base univer-text-black
+ univer-justify-center univer-text-base univer-text-gray-900
`}
>
<LinkSingle />
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/index.module.less b/packages/sheets-conditional-formatting-ui/src/components/panel/index.module.less
index 3901392501..fbf9e71a2d 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/index.module.less
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/index.module.less
@@ -42,32 +42,4 @@
width: 100px;
}
}
- .m-t-base {
- //16
- margin-top: var(--margin-base);
- }
- .m-t-sm {
- //12
- margin-top: var(--margin-sm);
- }
- .m-t-xl {
- margin-top: var(--margin-xl);
- }
- .m-l-sm {
- // 12
- margin-left: var(--margin-sm);
- }
- .m-l-xl {
- margin-left: var(--margin-xl);
- }
- .m-l-xxs {
- // 4
- margin-left: var(--margin-xxs);
- }
- .m-l-0 {
- margin-left: 0px;
- }
- .m-r-0 {
- margin-right: 0px;
- }
}
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/ColorScale.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/ColorScale.tsx
index db8058c729..0b5e344edd 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/ColorScale.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/ColorScale.tsx
@@ -229,11 +229,11 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
<div
className={clsx(`
${stylesBase.labelContainer}
- ${stylesBase.mTSm}
- `, 'univer-box-border univer-h-7')}
+ univer-mt-3
+ `, 'univer-box-border univer-h-8')}
>
<Select
- style={{ flexShrink: 0 }}
+ className="univer-flex-shrink-0"
options={minOptions}
value={minType}
onChange={(v) => {
@@ -245,9 +245,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
/>
<TextInput
id="min"
- className={`
- ${stylesBase.mLXxs}
- `}
+ className="univer-ml-1"
value={minValue}
type={minType}
onChange={(v) => {
@@ -256,7 +254,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
}}
/>
<ColorPicker
- className={stylesBase.mLXxs}
+ className="univer-ml-1"
color={minColor}
onChange={(v) => {
minColorSet(v);
@@ -268,11 +266,11 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
<div
className={clsx(`
${stylesBase.labelContainer}
- ${stylesBase.mTSm}
- `, 'univer-box-border univer-h-7')}
+ univer-mt-3
+ `, 'univer-box-border univer-h-8')}
>
<Select
- style={{ flexShrink: 0 }}
+ className="univer-flex-shrink-0"
options={medianOptions}
value={medianType}
onChange={(v) => {
@@ -285,9 +283,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
<TextInput
id="median"
- className={`
- ${stylesBase.mLXxs}
- `}
+ className="univer-ml-1"
value={medianValue}
type={medianType}
onChange={(v) => {
@@ -297,7 +293,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
/>
{medianType !== 'none' && (
<ColorPicker
- className={stylesBase.mLXxs}
+ className="univer-ml-1"
color={medianColor}
onChange={(v) => {
medianColorSet(v);
@@ -311,11 +307,11 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
<div
className={clsx(`
${stylesBase.labelContainer}
- ${stylesBase.mTSm}
- `, 'univer-box-border univer-h-7')}
+ univer-mt-3 univer-box-border univer-h-8
+ `)}
>
<Select
- style={{ flexShrink: 0 }}
+ className="univer-flex-shrink-0"
options={maxOptions}
value={maxType}
onChange={(v) => {
@@ -327,9 +323,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
/>
<TextInput
id="max"
- className={`
- ${stylesBase.mLXxs}
- `}
+ className="univer-ml-1"
value={maxValue}
type={maxType}
onChange={(v) => {
@@ -338,7 +332,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
}}
/>
<ColorPicker
- className={stylesBase.mLXxs}
+ className="univer-ml-1"
color={maxColor}
onChange={(v) => {
maxColorSet(v);
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/DataBar.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/DataBar.tsx
index 306b8fc992..f20cea4ca7 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/DataBar.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/DataBar.tsx
@@ -20,7 +20,6 @@ import type { IFormulaEditorRef } from '@univerjs/sheets-formula-ui';
import type { IStyleEditorProps } from './type';
import { IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
import { Checkbox, InputNumber, Radio, RadioGroup, Select } from '@univerjs/design';
-
import { CFRuleType, CFValueType, createDefaultValueByValueType, defaultDataBarNativeColor, defaultDataBarPositiveColor } from '@univerjs/sheets-conditional-formatting';
import { FormulaEditor } from '@univerjs/sheets-formula-ui';
import { useDependency, useSidebarClick } from '@univerjs/ui';
@@ -117,14 +116,14 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
const commonOptions = [createOptionItem(CFValueType.num, localeService), createOptionItem(CFValueType.percent, localeService), createOptionItem(CFValueType.percentile, localeService), createOptionItem(CFValueType.formula, localeService)];
const minOptions = [createOptionItem(CFValueType.min, localeService), ...commonOptions];
const maxOptions = [createOptionItem(CFValueType.max, localeService), ...commonOptions];
- const [minValueType, minValueTypeSet] = useState<CFValueType>(() => {
+ const [minValueType, setMinValueType] = useState<CFValueType>(() => {
const defaultV = minOptions[0].value as CFValueType;
if (!rule) {
return defaultV;
}
return rule.config?.min.type || defaultV;
});
- const [maxValueType, maxValueTypeSet] = useState<CFValueType>(() => {
+ const [maxValueType, setMaxValueType] = useState<CFValueType>(() => {
const defaultV = maxOptions[0].value as CFValueType;
if (!rule) {
return defaultV;
@@ -142,7 +141,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
}
return value.value || defaultV;
});
- const [maxValue, maxValueSet] = useState(() => {
+ const [maxValue, setMaxValue] = useState(() => {
const defaultV = 100;
if (!rule) {
return defaultV;
@@ -154,7 +153,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
return value.value === undefined ? defaultV : value.value;
});
- const [isShowValue, isShowValueSet] = useState(() => {
+ const [isShowValue, setIsShowValue] = useState(() => {
const defaultV = true;
if (!rule) {
return defaultV;
@@ -242,8 +241,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
- ${stylesBase.mTSm}
- ${stylesBase.mLXxs}
+ univer-ml-1 univer-mt-3
${stylesBase.labelContainer}
`}
>
@@ -264,13 +262,13 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${styles.utilItem}
- ${stylesBase.mLXl}
+ univer-ml-6
`}
>
<Checkbox
checked={!isShowValue}
onChange={(v) => {
- isShowValueSet(!v);
+ setIsShowValue(!v);
_handleChange({ isGradient: v as string, minValue, minValueType, maxValue, maxValueType, positiveColor, nativeColor, isShowValue: !v });
}}
/>
@@ -283,8 +281,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${stylesBase.labelContainer}
- ${stylesBase.mTSm}
- ${stylesBase.mLXxs}
+ univer-ml-1 univer-mt-3
`}
>
<div
@@ -307,7 +304,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${stylesBase.labelContainer}
- ${stylesBase.mLSm}
+ univer-ml-3
`}
>
<div
@@ -327,18 +324,13 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
</div>
<div>
<div className={stylesBase.label}>{localeService.t('sheet.cf.valueType.min')}</div>
- <div
- className={`
- ${stylesBase.mTSm}
- ${stylesBase.labelContainer}
- `}
- >
+ <div className="univer-mt-3 univer-flex univer-items-center">
<Select
- style={{ width: '50%', flexShrink: 0 }}
+ className="univer-w-1/2 univer-flex-shrink-0"
options={minOptions}
value={minValueType}
onChange={(v) => {
- minValueTypeSet(v as CFValueType);
+ setMinValueType(v as CFValueType);
const value = createDefaultValueByValueType(v as CFValueType, 10);
minValueSet(value);
_handleChange({ isGradient, minValue: value, minValueType: v as CFValueType, maxValue, maxValueType, positiveColor, nativeColor, isShowValue });
@@ -349,7 +341,7 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
disabled={!isShowInput(minValueType)}
id="min"
type={minValueType}
- className={stylesBase.mLSm}
+ className="univer-ml-3"
value={minValue}
onChange={(v) => {
minValueSet(v || 0);
@@ -358,31 +350,26 @@ export const DataBarStyleEditor = (props: IStyleEditorProps) => {
/>
</div>
<div className={stylesBase.label}>{localeService.t('sheet.cf.valueType.max')}</div>
- <div
- className={`
- ${stylesBase.mTSm}
- ${stylesBase.labelContainer}
- `}
- >
+ <div className="univer-mt-3 univer-flex univer-items-center">
<Select
- style={{ width: '50%', flexShrink: 0 }}
+ className="univer-w-1/2 univer-flex-shrink-0"
options={maxOptions}
value={maxValueType}
onChange={(v) => {
- maxValueTypeSet(v as CFValueType);
+ setMaxValueType(v as CFValueType);
const value = createDefaultValueByValueType(v as CFValueType, 90);
- maxValueSet(value);
+ setMaxValue(value);
_handleChange({ isGradient, minValue, minValueType, maxValue: value, maxValueType: v as CFValueType, positiveColor, nativeColor, isShowValue });
}}
/>
<InputText
+ className="univer-ml-3"
disabled={!isShowInput(maxValueType)}
id="max"
type={maxValueType}
- className={stylesBase.mLSm}
value={maxValue}
onChange={(v) => {
- maxValueSet(v || 0);
+ setMaxValue(v || 0);
_handleChange({ isGradient, minValue, minValueType, maxValue: v || 0, maxValueType, positiveColor, nativeColor, isShowValue });
}}
/>
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Formula.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Formula.tsx
index c1f2eb55af..81d9dc4f3c 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Formula.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Formula.tsx
@@ -99,17 +99,12 @@ export const FormulaStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${stylesBase.title}
- ${stylesBase.mTBase}
+ univer-mt-4
`}
>
{localeService.t('sheet.cf.panel.styleRule')}
</div>
- <div
- className={`
- ${stylesBase.mTSm}
- `}
- >
-
+ <div className="univer-mt-3">
<FormulaEditor
onChange={(formula) => {
formulaSet(formula);
@@ -142,9 +137,7 @@ export const FormulaStyleEditor = (props: IStyleEditorProps) => {
</div>
<ConditionalStyleEditor
style={rule?.style}
- className={`
- ${stylesBase.mTSm}
- `}
+ className="univer-mt-3"
onChange={(v) => {
styleSet(v);
_onChange({ style: v, formula });
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/HighlightCell.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/HighlightCell.tsx
index 643d79d2da..ee8ebc6870 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/HighlightCell.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/HighlightCell.tsx
@@ -116,14 +116,9 @@ const HighlightCellInput = (props: {
onChange(value);
};
return (
- <div
- className={`
- ${stylesBase.mTSm}
- `}
- >
+ <div className="univer-mt-3">
<WrapperError errorText={textError}>
<Input
- className={styles.width100}
value={inputTextValue}
onChange={(v) => {
textErrorSet('');
@@ -144,13 +139,15 @@ const HighlightCellInput = (props: {
numberErrorSet('');
};
return (
- <div
- className={`
- ${stylesBase.mTSm}
- `}
- >
+ <div className="univer-mt-3">
<WrapperError errorText={numberError}>
- <InputNumber min={Number.MIN_SAFE_INTEGER} max={Number.MAX_SAFE_INTEGER} className={styles.width100} value={inputNumberValue} onChange={_onChange} />
+ <InputNumber
+ className="univer-w-full"
+ min={Number.MIN_SAFE_INTEGER}
+ max={Number.MAX_SAFE_INTEGER}
+ value={inputNumberValue}
+ onChange={_onChange}
+ />
</WrapperError>
</div>
);
@@ -171,7 +168,7 @@ const HighlightCellInput = (props: {
return (
<div
className={`
- ${stylesBase.mTSm}
+ univer-mt-3
${stylesBase.labelContainer}
`}
>
@@ -180,11 +177,9 @@ const HighlightCellInput = (props: {
</WrapperError>
<WrapperError errorText={numberMaxError}>
<InputNumber
+ className="univer-ml-3"
min={Number.MIN_SAFE_INTEGER}
max={Number.MAX_SAFE_INTEGER}
- className={`
- ${stylesBase.mLSm}
- `}
value={inputNumberMax}
onChange={onChangeMax}
/>
@@ -381,31 +376,27 @@ export const HighlightCellStyleEditor = (props: IStyleEditorProps<any, ITextHigh
<div
className={`
${stylesBase.title}
- ${stylesBase.mTBase}
+ univer-mt-4
`}
>
{localeService.t('sheet.cf.panel.styleRule')}
</div>
- <Select
- className={`
- ${stylesBase.mTSm}
- ${styles.width100}
- `}
- onChange={onTypeChange}
- value={subType}
- options={typeOptions}
- />
- {operatorOptions?.length && (
+ <div className="univer-flex univer-justify-between univer-gap-4">
<Select
- className={`
- ${stylesBase.mTSm}
- ${styles.width100}
- `}
- onChange={onOperatorChange}
- value={operator || ''}
- options={operatorOptions}
+ className="univer-mt-3 univer-w-full"
+ onChange={onTypeChange}
+ value={subType}
+ options={typeOptions}
/>
- )}
+ {operatorOptions?.length && (
+ <Select
+ className="univer-mt-3 univer-w-full"
+ onChange={onOperatorChange}
+ value={operator || ''}
+ options={operatorOptions}
+ />
+ )}
+ </div>
<HighlightCellInput key={inputRenderKey} value={value} interceptorManager={interceptorManager} type={subType} operator={operator} rule={rule} onChange={onInputChange} />
<div
className={`
@@ -416,9 +407,7 @@ export const HighlightCellStyleEditor = (props: IStyleEditorProps<any, ITextHigh
</div>
<ConditionalStyleEditor
style={rule?.style}
- className={`
- ${stylesBase.mLXxs}
- `}
+ className="univer-ml-1"
onChange={(v) => {
styleSet(v);
onChange(getResult({ style: v }));
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/IconSet.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/IconSet.tsx
index 04fbfcfed3..30df4462a3 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/IconSet.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/IconSet.tsx
@@ -17,12 +17,10 @@
import type { Workbook } from '@univerjs/core';
import type { IIconSet, IIconType } from '@univerjs/sheets-conditional-formatting';
import type { IFormulaEditorRef } from '@univerjs/sheets-formula-ui';
-
import type { IStyleEditorProps } from './type';
import { get, IUniverInstanceService, LocaleService, set, Tools, UniverInstanceType } from '@univerjs/core';
import { Checkbox, clsx, Dropdown, InputNumber, Select } from '@univerjs/design';
import { MoreDownSingle, SlashSingle } from '@univerjs/icons';
-
import {
CFNumberOperator,
CFRuleType,
@@ -37,9 +35,7 @@ import {
} from '@univerjs/sheets-conditional-formatting';
import { FormulaEditor } from '@univerjs/sheets-formula-ui';
import { ILayoutService, useDependency, useScrollYOverContainer, useSidebarClick } from '@univerjs/ui';
-
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
-
import stylesBase from '../index.module.less';
import styles from './index.module.less';
@@ -80,7 +76,7 @@ const TextInput = (props: { id: number; type: CFValueType; value: number | strin
</>
)
: (
- <div style={{ width: '100%' }}>
+ <div className="univer-w-full">
<FormulaEditor
initValue={String(props.value) as any}
unitId={unitId}
@@ -126,7 +122,13 @@ const IconGroupList = forwardRef<HTMLDivElement, IconGroupListProps>((props, ref
return (
<div className={styles.itemWrap} key={groupItem.name} onClick={() => { handleClick(groupItem.name); }}>
<div className={styles.item}>
- {groupItem.list.map((base64, index) => <img className={styles.icon} key={index} src={base64} />)}
+ {groupItem.list.map((base64, index) => (
+ <img
+ key={index}
+ className="univer-size-5"
+ src={base64}
+ />
+ ))}
</div>
</div>
);
@@ -162,17 +164,15 @@ const IconItemList = (props: { onClick: (iconType: IIconType, iconId: string) =>
return (
<div className={styles.iconItemListWrap}>
<div className={styles.none} onClick={() => handleClick({ iconType: EMPTY_ICON_TYPE as any, iconId: '', base64: '' })}>
- <SlashSingle className={styles.icon} />
+ <SlashSingle className="univer-size-5" />
<span>无单元格图标</span>
</div>
<div className={styles.iconItemList}>
{list.map((item) => (
<div key={`${item.iconType}_${item.iconId}`} className={styles.item}>
<img
+ className="univer-size-5"
onClick={() => handleClick(item)}
- className={`
- ${styles.icon}
- `}
src={item.base64}
/>
</div>
@@ -231,30 +231,22 @@ const IconSetRuleEdit = (props: {
return (
<div
key={index}
- className={`
- ${index ? stylesBase.mTXl : stylesBase.mTSm}
- `}
+ className={index ? 'univer-mt-6' : 'univer-mt-3'}
>
<div
className={`
${stylesBase.label}
- ${styles.flex}
+ univer-flex univer-items-center univer-justify-between
`}
>
<div
- className={`
- ${styles.width45}
- `}
+ className="univer-w-[45%]"
>
{localeService.t('sheet.cf.iconSet.icon')}
{index + 1}
</div>
- <div
- className={`
- ${styles.width45}
- `}
- >
+ <div className="univer-w-[45%]">
<>
{!isFirst && !isEnd && localeService.t('sheet.cf.iconSet.rule')}
{!isFirst && !isEnd && (
@@ -269,22 +261,10 @@ const IconSetRuleEdit = (props: {
)}
</>
-
</div>
-
</div>
- <div
- className={`
- ${styles.flex}
- ${stylesBase.mTSm}
- `}
- >
- <div
- className={`
- ${styles.iconWrap}
- ${styles.width45}
- `}
- >
+ <div className="univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4">
+ <div className="univer-flex univer-items-center">
<Dropdown
overlay={(
<div className="univer-rounded-lg univer-p-4">
@@ -297,16 +277,10 @@ const IconSetRuleEdit = (props: {
<MoreDownSingle />
</div>
</Dropdown>
-
</div>
{!isEnd
? (
<Select
- className={`
- ${stylesBase.mL0}
- ${styles.width45}
- ${stylesBase.mR0}
- `}
options={options}
value={item.operator}
onChange={(v) => { handleOperatorChange(v as CFNumberOperator, index); }}
@@ -315,19 +289,17 @@ const IconSetRuleEdit = (props: {
: (
<div
className={`
- ${styles.width45}
+ univer-w-[45%]
${stylesBase.label}
`}
style={{ marginTop: 0 }}
>
{localeService.t('sheet.cf.iconSet.rule')}
<span className={styles.stress}>
- (
{localeService.t('sheet.cf.iconSet.when')}
{localeService.t(`sheet.cf.symbol.${getOppositeOperator(preItem.operator)}`)}
{lessThanText}
{isEnd ? '' : ` ${localeService.t('sheet.cf.iconSet.and')} `}
- )
</span>
</div>
)}
@@ -337,62 +309,46 @@ const IconSetRuleEdit = (props: {
<>
<div
className={`
- ${stylesBase.mTSm}
+ univer-mt-3
${stylesBase.label}
- ${styles.flex}
+ univer-flex univer-items-center univer-justify-between univer-gap-4
`}
>
- <div
- className={`
- ${styles.width45}
- `}
- >
+ <div>
{localeService.t('sheet.cf.iconSet.type')}
</div>
- <div
- className={`
- ${styles.width45}
- `}
- >
+ <div>
{localeService.t('sheet.cf.iconSet.value')}
</div>
</div>
<div
className={`
- ${stylesBase.mTSm}
- ${styles.flex}
+ univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4
`}
>
<Select
- style={{ flexShrink: 0 }}
- className={`
- ${styles.width45}
- ${stylesBase.mL0}
- `}
+ className="univer-flex-shrink-0"
options={valueTypeOptions}
value={item.value.type}
- onChange={(v) => { handleValueTypeChange(v as CFNumberOperator, index); }}
+ onChange={(v) => {
+ handleValueTypeChange(v as CFNumberOperator, index);
+ }}
/>
- <div
- className={`
- ${stylesBase.mL0}
- ${styles.width45}
- `}
- >
+ <div>
<TextInput
id={index}
type={item.value.type}
error={error}
value={item.value.value || ''}
- onChange={(v) => handleValueValueChange(v, index)}
+ onChange={(v) => {
+ handleValueValueChange(v, index);
+ }}
/>
</div>
-
</div>
</>
)
: <div />}
-
</div>
);
});
@@ -448,16 +404,16 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
return getIcon(item.iconType, item.iconId);
});
return (
- <div className={styles.iconWrap}>
+ <div className="univer-flex univer-items-center">
{list.map((icon, index) => (icon
? (
<img
- className={styles.icon}
+ className="univer-size-5"
key={index}
src={icon}
/>
)
- : <SlashSingle className={styles.icon} key={index} />))}
+ : <SlashSingle className="univer-size-5" key={index} />))}
</div>
);
}, [configList]);
@@ -562,9 +518,7 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
<div className={styles.iconSet}>
<div className={stylesBase.title}>{localeService.t('sheet.cf.panel.styleRule')}</div>
<div
- className={`
- ${stylesBase.mTSm}
- `}
+ className="univer-mt-3"
>
<Dropdown
overlay={(
@@ -587,7 +541,7 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
</div>
<div
className={`
- ${stylesBase.mTSm}
+ univer-mt-3
${styles.renderConfig}
`}
>
@@ -598,7 +552,7 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
<div
className={`
${styles.utilItem}
- ${stylesBase.mLXl}
+ univer-ml-6
`}
>
<Checkbox checked={!isShowValue} onChange={(v) => { isShowValueSet(!v); }} />
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Rank.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Rank.tsx
index 2b97032451..20751eff0d 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Rank.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/Rank.tsx
@@ -145,16 +145,13 @@ export const RankStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${stylesBase.title}
- ${stylesBase.mTBase}
+ univer-mt-4
`}
>
{localeService.t('sheet.cf.panel.styleRule')}
</div>
<Select
- className={`
- ${styles.width100}
- ${stylesBase.mTSm}
- `}
+ className="univer-mt-3 univer-w-full"
value={type}
options={options}
onChange={(v) => {
@@ -166,7 +163,7 @@ export const RankStyleEditor = (props: IStyleEditorProps) => {
<div
className={`
${stylesBase.labelContainer}
- ${stylesBase.mTSm}
+ univer-mt-3
`}
>
<InputNumber
@@ -181,7 +178,7 @@ export const RankStyleEditor = (props: IStyleEditorProps) => {
/>
<div
className={`
- ${stylesBase.mLSm}
+ univer-ml-3
${stylesBase.labelContainer}
${styles.text}
`}
@@ -207,9 +204,7 @@ export const RankStyleEditor = (props: IStyleEditorProps) => {
</div>
<ConditionalStyleEditor
style={rule?.style}
- className={`
- ${stylesBase.mTSm}
- `}
+ className="univer-mt-3"
onChange={(v) => {
styleSet(v);
_onChange({ type, isPercent, value, style: v });
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.module.less b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.module.less
index 9a3757d3e3..74d4214e45 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.module.less
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.module.less
@@ -38,22 +38,6 @@
font-size: var(--font-size-xxs);
justify-content: flex-start;
}
- .flex {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .width45 {
- width: 45%;
- }
- .icon-wrap {
- display: flex;
- align-items: center;
- }
- .icon {
- width: 20px;
- height: 20px;
- }
.dropdown-icon {
background-color: rgb(var(--bg-color-secondary));
border: 1px solid rgb(var(--border-color));
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx
index f18800367a..1c47edf03d 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx
@@ -233,11 +233,7 @@ export const RuleEdit = (props: IRuleEditProps) => {
return (
<div className={styles.cfRuleStyleEditor}>
<div className={styleBase.title}>{localeService.t('sheet.cf.panel.range')}</div>
- <div
- className={`
- ${styleBase.mTBase}
- `}
- >
+ <div className="univer-mt-4">
<RangeSelector
unitId={unitId}
subUnitId={subUnitId}
@@ -248,27 +244,20 @@ export const RuleEdit = (props: IRuleEditProps) => {
{errorText && <div className={styles.cfErrorText}>{errorText}</div>}
</div>
<div className={styleBase.title}>{localeService.t('sheet.cf.panel.styleType')}</div>
- <div className={styleBase.mTBase}>
- <Select
- className={styles.width100}
- value={ruleType}
- options={options}
- onChange={(e) => ruleTypeSet(e)}
- />
- </div>
+ <Select
+ className="univer-mt-4 univer-w-full"
+ value={ruleType}
+ options={options}
+ onChange={(e) => ruleTypeSet(e)}
+ />
<StyleEditor
interceptorManager={interceptorManager}
rule={props.rule?.rule as any}
onChange={onStyleChange}
/>
- <div
- className={`
- ${styleBase.mTBase}
- ${styles.btnList}
- `}
- >
+ <div className="univer-mt-4 univer-flex univer-justify-end">
<Button onClick={handleCancel}>{localeService.t('sheet.cf.panel.cancel')}</Button>
- <Button className={styleBase.mLSm} variant="primary" onClick={handleSubmit}>
+ <Button className="univer-ml-3" variant="primary" onClick={handleSubmit}>
{localeService.t('sheet.cf.panel.submit')}
</Button>
</div>
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx
index c6eeaeedf7..8db470aacd 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx
@@ -332,10 +332,10 @@ export const RuleList = (props: IRuleListProps) => {
/>
).map((ele, index) => <span key={index}>{ele}</span>)}
</div>
- <div className={styles.btnList}>
+ <div className="univer-flex univer-justify-end">
<Tooltip title={localeService.t('sheet.cf.panel.createRule')} placement="bottom">
<div
- className={styles.icon}
+ className="univer-size-5"
onClick={handleCreate}
>
<IncreaseSingle />
@@ -345,7 +345,7 @@ export const RuleList = (props: IRuleListProps) => {
? (
<Tooltip title={localeService.t('sheet.cf.panel.clear')} placement="bottom">
<div
- className={clsx(styles.gap, styles.icon)}
+ className={clsx(styles.gap, 'univer-size-5')}
onClick={handleClear}
>
<DeleteSingle />
@@ -403,7 +403,7 @@ export const RuleList = (props: IRuleListProps) => {
{rule.ranges.map((range) => serializeRange(range)).join(',')}
</div>
</div>
- <div className={styles.preview}>
+ <div>
<Preview rule={rule.rule} />
</div>
<div
diff --git a/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx b/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
index 127ae4fe9b..b51115f701 100644
--- a/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
+++ b/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
@@ -276,11 +276,11 @@ export function DataValidationDetail() {
<Select
className="univer-w-full"
value={localRule.type}
- onChange={handleChangeType}
options={validators?.sort((a, b) => a.order - b.order)?.map((validator) => ({
label: localeService.t(validator.title),
value: validator.id,
}))}
+ onChange={handleChangeType}
/>
</FormLayout>
{operators?.length
@@ -289,12 +289,6 @@ export function DataValidationDetail() {
<Select
className="univer-w-full"
value={`${localRule.operator}`}
- onChange={(operator) => {
- handleUpdateRuleSetting({
- ...baseRule,
- operator: operator as DataValidationOperator,
- });
- }}
options={[
{
value: '',
@@ -305,6 +299,12 @@ export function DataValidationDetail() {
label: operatorNames[i],
})),
]}
+ onChange={(operator) => {
+ handleUpdateRuleSetting({
+ ...baseRule,
+ operator: operator as DataValidationOperator,
+ });
+ }}
/>
</FormLayout>
)
diff --git a/packages/sheets-data-validation-ui/src/views/components/formula-input/ListFormulaInput.tsx b/packages/sheets-data-validation-ui/src/views/components/formula-input/ListFormulaInput.tsx
index 1439f34a6e..58bc7b17d6 100644
--- a/packages/sheets-data-validation-ui/src/views/components/formula-input/ListFormulaInput.tsx
+++ b/packages/sheets-data-validation-ui/src/views/components/formula-input/ListFormulaInput.tsx
@@ -20,7 +20,7 @@ import type { IFormulaEditorRef } from '@univerjs/sheets-formula-ui';
import type { CSSProperties } from 'react';
import { DataValidationType, isFormulaString, LocaleService, Tools } from '@univerjs/core';
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
-import { clsx, DraggableList, FormLayout, Input, Radio, RadioGroup, Select } from '@univerjs/design';
+import { clsx, DraggableList, FormLayout, Input, LegacySelect, Radio, RadioGroup } from '@univerjs/design';
import { DeleteSingle, IncreaseSingle, SequenceSingle } from '@univerjs/icons';
import { DataValidationFormulaController, deserializeListOptions, serializeListOptions } from '@univerjs/sheets-data-validation';
import { FormulaEditor } from '@univerjs/sheets-formula-ui';
@@ -73,7 +73,7 @@ const ColorSelect = (props: IColorSelectProps) => {
const { value, onChange, disabled } = props;
const [open, setOpen] = useState(false);
return (
- <Select
+ <LegacySelect
disabled={disabled}
open={open}
onDropdownVisibleChange={setOpen}
diff --git a/packages/sheets-filter-ui/src/views/components/SheetsFilterByConditionsPanel.tsx b/packages/sheets-filter-ui/src/views/components/SheetsFilterByConditionsPanel.tsx
index 25debb9a78..ad330e6a15 100644
--- a/packages/sheets-filter-ui/src/views/components/SheetsFilterByConditionsPanel.tsx
+++ b/packages/sheets-filter-ui/src/views/components/SheetsFilterByConditionsPanel.tsx
@@ -62,10 +62,19 @@ export function FilterByCondition(props: { model: ByConditionsModel }) {
<Radio value="OR">{localeService.t('sheets-filter.panel.or')}</Radio>
</RadioGroup>
)}
- <Select value={operator} options={secondaryOptions} onChange={(operator) => onFormParamsChange({ [name]: operator as FilterOperator })} />
+ <Select
+ value={operator}
+ options={secondaryOptions}
+ onChange={(operator) => onFormParamsChange({ [name]: operator as FilterOperator })}
+ />
{shouldRenderInput && (
<div>
- <Input className="univer-mt-2" value={val} placeholder={placeholder} onChange={(value) => onFormParamsChange({ [name === 'operator1' ? 'val1' : 'val2']: value })} />
+ <Input
+ className="univer-mt-2"
+ value={val}
+ placeholder={placeholder}
+ onChange={(value) => onFormParamsChange({ [name === 'operator1' ? 'val1' : 'val2']: value })}
+ />
</div>
)}
</>
@@ -86,8 +95,8 @@ export function FilterByCondition(props: { model: ByConditionsModel }) {
<div
data-univer-comp-sheets-filter-panel-conditions-container-inner
className={`
- univer-flex-grow univer-overflow-hidden univer-rounded-md univer-border
- univer-border-gray-200 univer-p-2 univer-border-solid univer-mt-2
+ univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-border
+ univer-border-solid univer-border-gray-200 univer-p-2
`}
>
{condition.numOfParameters >= 1 && renderSecondaryCondition(formParams.operator1!, formParams.val1 ?? '', 'operator1')}
diff --git a/packages/sheets-numfmt-ui/src/views/components/accounting/index.tsx b/packages/sheets-numfmt-ui/src/views/components/accounting/index.tsx
index db91a65c0f..60f5720cfc 100644
--- a/packages/sheets-numfmt-ui/src/views/components/accounting/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/accounting/index.tsx
@@ -54,11 +54,11 @@ export const AccountingPanel: FC<IBusinessComponentProps> = (props) => {
return (
<div>
- <div className="m-t-16 options">
+ <div className="univer-mt-4 univer-flex univer-justify-between">
<div className="option">
- <div className="label">{t('sheet.numfmt.decimalLength')}</div>
+ <div className="univer-text-sm univer-text-gray-400">{t('sheet.numfmt.decimalLength')}</div>
- <div className="m-t-8 w-120">
+ <div className="univer-mt-2 univer-w-32">
<InputNumber
value={decimal}
step={1}
@@ -70,9 +70,9 @@ export const AccountingPanel: FC<IBusinessComponentProps> = (props) => {
</div>
</div>
<div className="option">
- <div className="label">{t('sheet.numfmt.currencyType')}</div>
+ <div className="univer-text-sm univer-text-gray-400">{t('sheet.numfmt.currencyType')}</div>
- <div className="m-t-8 w-140">
+ <div className="univer-mt-2 univer-w-36">
<Select
options={options}
value={suffix}
@@ -82,7 +82,7 @@ export const AccountingPanel: FC<IBusinessComponentProps> = (props) => {
</div>
</div>
- <div className="describe m-t-14">{t('sheet.numfmt.accountingDes')}</div>
+ <div className="univer-mt-4 univer-text-sm univer-text-gray-400">{t('sheet.numfmt.accountingDes')}</div>
</div>
);
};
diff --git a/packages/sheets-numfmt-ui/src/views/components/currency/index.less b/packages/sheets-numfmt-ui/src/views/components/currency/index.less
deleted file mode 100644
index ea6adc7bf7..0000000000
--- a/packages/sheets-numfmt-ui/src/views/components/currency/index.less
+++ /dev/null
@@ -1,12 +0,0 @@
-.options {
- display: flex;
- justify-content: space-between;
-
- .w-140 {
- width: 140px;
- }
-
- .w-120 {
- width: 120px;
- }
-}
diff --git a/packages/sheets-numfmt-ui/src/views/components/currency/index.tsx b/packages/sheets-numfmt-ui/src/views/components/currency/index.tsx
index 67b2e95e16..a9dbb86913 100644
--- a/packages/sheets-numfmt-ui/src/views/components/currency/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/currency/index.tsx
@@ -20,12 +20,9 @@ import { LocaleService } from '@univerjs/core';
import { InputNumber, Select, SelectList } from '@univerjs/design';
import { getCurrencyFormatOptions, getCurrencyType, getDecimalFromPattern, isPatternEqualWithoutDecimal, setPatternDecimal } from '@univerjs/sheets-numfmt';
import { useDependency } from '@univerjs/ui';
-import React, { useContext, useMemo, useState } from 'react';
+import { useContext, useMemo, useState } from 'react';
import { UserHabitCurrencyContext } from '../../../controllers/user-habit.controller';
-// FIXME: DO NOT USE GLOBAL STYLES
-import './index.less';
-
export const isCurrencyPanel = (pattern: string) => {
const type = getCurrencyType(pattern);
return !!type && !pattern.startsWith('_(');
@@ -75,29 +72,38 @@ export const CurrencyPanel: FC<IBusinessComponentProps> = (props) => {
return (
<div>
- <div className="m-t-16 options">
+ <div className="univer-mt-4 univer-flex univer-justify-between">
<div className="option">
- <div className="label">{t('sheet.numfmt.decimalLength')}</div>
- <div className="m-t-8 w-120">
- <InputNumber value={decimal} max={20} min={0} onChange={onDecimalChange} />
+ <div className="univer-text-sm univer-text-gray-400">{t('sheet.numfmt.decimalLength')}</div>
+ <div className="univer-mt-2 univer-w-32">
+ <InputNumber
+ value={decimal}
+ max={20}
+ min={0}
+ onChange={onDecimalChange}
+ />
</div>
</div>
<div className="option">
- <div className="label">{t('sheet.numfmt.currencyType')}</div>
- <div className="m-t-8 w-140">
- <Select onChange={onSelect} options={options} value={suffix} />
+ <div className="univer-text-sm univer-text-gray-400">{t('sheet.numfmt.currencyType')}</div>
+ <div className="univer-mt-2 univer-w-36">
+ <Select
+ value={suffix}
+ options={options}
+ onChange={onSelect}
+ />
</div>
</div>
</div>
- <div className="m-t-16 label">
+ <div className="univer-mt-4 label">
{t('sheet.numfmt.negType')}
</div>
- <div className="m-t-8">
- <SelectList onChange={onChange} options={negativeOptions} value={pattern} />
+ <div className="univer-mt-2">
+ <SelectList value={pattern} options={negativeOptions} onChange={onChange} />
</div>
- <div className="describe m-t-14">{t('sheet.numfmt.currencyDes')}</div>
+ <div className="univer-mt-4 univer-text-sm univer-text-gray-400">{t('sheet.numfmt.currencyDes')}</div>
</div>
);
};
diff --git a/packages/sheets-numfmt-ui/src/views/components/date/index.tsx b/packages/sheets-numfmt-ui/src/views/components/date/index.tsx
index ab7345c7ad..ca0533631a 100644
--- a/packages/sheets-numfmt-ui/src/views/components/date/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/date/index.tsx
@@ -20,7 +20,7 @@ import { LocaleService, numfmt } from '@univerjs/core';
import { SelectList } from '@univerjs/design';
import { getDateFormatOptions } from '@univerjs/sheets-numfmt';
import { useDependency } from '@univerjs/ui';
-import React, { useMemo, useState } from 'react';
+import { useMemo, useState } from 'react';
export const isDatePanel = (pattern: string) => {
const info = numfmt.getInfo(pattern);
@@ -57,11 +57,13 @@ export const DatePanel: FC<IBusinessComponentProps> = (props) => {
return (
<div>
- <div className="m-t-16 label">{t('sheet.numfmt.dateType')}</div>
- <div className="m-t-8">
+ <div className="univer-mt-4 univer-text-sm univer-text-gray-400">{t('sheet.numfmt.dateType')}</div>
+ <div className="univer-mt-2">
<SelectList value={suffix} options={options} onChange={onChange} />
</div>
- <div className="describe m-t-14">{t('sheet.numfmt.dateDes')}</div>
+ <div className="univer-mt-3.5 univer-text-[13px]/5 univer-text-gray-600">
+ {t('sheet.numfmt.dateDes')}
+ </div>
</div>
);
};
diff --git a/packages/sheets-numfmt-ui/src/views/components/general/index.tsx b/packages/sheets-numfmt-ui/src/views/components/general/index.tsx
index a91c6097eb..2ce70d1de0 100644
--- a/packages/sheets-numfmt-ui/src/views/components/general/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/general/index.tsx
@@ -29,7 +29,9 @@ export const GeneralPanel: FC<IBusinessComponentProps> = (props) => {
return (
<div>
- <div className="describe m-t-14">{t('sheet.numfmt.generalDes')}</div>
+ <div className="univer-mt-3.5 univer-text-[13px]/5 univer-text-gray-600">
+ {t('sheet.numfmt.generalDes')}
+ </div>
</div>
);
};
diff --git a/packages/sheets-numfmt-ui/src/views/components/index.less b/packages/sheets-numfmt-ui/src/views/components/index.less
deleted file mode 100644
index d7d29dd902..0000000000
--- a/packages/sheets-numfmt-ui/src/views/components/index.less
+++ /dev/null
@@ -1,61 +0,0 @@
-.numfmt-panel {
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- height: 100%;
-
- .group-title {
- font-size: 16px;
- color: rgba(var(--color-black));
- }
-
- .label {
- font-size: 15px;
- color: rgba(var(--grey-400));
- }
-
- .describe {
- font-size: 13px;
- line-height: 20px;
- color: rgba(var(--grey-600));
- }
-
- .preview {
- height: 36px;
- padding: 0 16px;
-
- font-size: 14px;
- line-height: 36px;
- color: var(--color-black);
-
- border: 1px solid rgb(var(--grey-200));
- border-radius: 4px;
- }
-
- .btn-list {
- display: flex;
- justify-content: flex-end;
- }
-
- .m-r-12 {
- margin-right: 12px;
- }
-
- .m-t-16 {
- margin-top: 16px;
- }
-
- .m-t-14 {
- margin-top: 14px;
- }
-
- .m-t-8 {
- margin-top: 8px;
- }
-
- .m-b-20 {
- margin-bottom: 20px;
- }
-}
diff --git a/packages/sheets-numfmt-ui/src/views/components/index.tsx b/packages/sheets-numfmt-ui/src/views/components/index.tsx
index f89fdec374..420a9369e0 100644
--- a/packages/sheets-numfmt-ui/src/views/components/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/index.tsx
@@ -21,21 +21,16 @@ import { LocaleService } from '@univerjs/core';
import { Button, Select } from '@univerjs/design';
import { getCurrencyType } from '@univerjs/sheets-numfmt';
import { useDependency } from '@univerjs/ui';
-import React, { useEffect, useMemo, useRef, useState } from 'react';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { UserHabitCurrencyContext } from '../../controllers/user-habit.controller';
import { useCurrencyOptions } from '../hooks/use-currency-options';
import { useNextTick } from '../hooks/use-next-tick';
import { AccountingPanel, isAccountingPanel } from './accounting';
import { CurrencyPanel, isCurrencyPanel } from './currency';
import { CustomFormat } from './custom-format';
-
import { DatePanel, isDatePanel } from './date';
import { GeneralPanel, isGeneralPanel } from './general';
-
import { isThousandthPercentilePanel, ThousandthPercentilePanel } from './thousandth-percentile';
-// TODO: @Gggpound: fix this
-// FIXME: DO NOT USE GLOBAL STYLES
-import './index.less';
export interface ISheetNumfmtPanelProps {
value: { defaultValue: number; defaultPattern: string; row: number; col: number };
@@ -59,9 +54,9 @@ export const SheetNumfmtPanel: FC<ISheetNumfmtPanelProps> = (props) => {
].map((item) => ({ ...item, label: t(item.label) })),
[]
);
- const [type, typeSet] = useState(findDefaultType);
- const [key, keySet] = useState(() => `${row}_${col}`);
- const { mark, userHabitCurrency } = useCurrencyOptions(() => keySet(`${row}_${col}_userCurrency'`));
+ const [type, setType] = useState(findDefaultType);
+ const [key, setKey] = useState(() => `${row}_${col}`);
+ const { mark, userHabitCurrency } = useCurrencyOptions(() => setKey(`${row}_${col}_userCurrency'`));
const BusinessComponent = useMemo(() => typeOptions.find((item) => item.label === type)?.component, [type]);
@@ -79,7 +74,7 @@ export const SheetNumfmtPanel: FC<ISheetNumfmtPanelProps> = (props) => {
}));
const handleSelect: ISelectProps['onChange'] = (value) => {
- typeSet(value);
+ setType(value);
// after the BusinessComponent render.
nextTick(() => props.onChange({ type: 'change', value: getCurrentPattern.current() || '' }));
};
@@ -108,16 +103,20 @@ export const SheetNumfmtPanel: FC<ISheetNumfmtPanelProps> = (props) => {
};
useEffect(() => {
- typeSet(findDefaultType());
- keySet(`${row}_${col}`);
+ setType(findDefaultType());
+ setKey(`${row}_${col}`);
}, [row, col]);
return (
- <div className="numfmt-panel p-b-20">
+ <div
+ className={`
+ univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5
+ `}
+ >
<div>
- <div className="label m-t-14">{t('sheet.numfmt.numfmtType')}</div>
- <div className="m-t-8">
- <Select onChange={handleSelect} options={selectOptions} value={type} style={{ width: '100%' }} />
+ <div className="univer-mt-3.5 univer-text-sm univer-text-gray-400">{t('sheet.numfmt.numfmtType')}</div>
+ <div className="univer-mt-2">
+ <Select className="univer-w-full" value={type} options={selectOptions} onChange={handleSelect} />
</div>
<div>
{BusinessComponent && (
@@ -128,8 +127,8 @@ export const SheetNumfmtPanel: FC<ISheetNumfmtPanelProps> = (props) => {
</div>
</div>
- <div className="btn-list m-t-14 m-b-20">
- <Button onClick={handleCancel} className="m-r-12">
+ <div className="univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end">
+ <Button onClick={handleCancel} className="univer-mr-3">
{t('sheet.numfmt.cancel')}
</Button>
<Button variant="primary" onClick={handleConfirm}>
diff --git a/packages/sheets-numfmt-ui/src/views/components/thousandth-percentile/index.tsx b/packages/sheets-numfmt-ui/src/views/components/thousandth-percentile/index.tsx
index 2f8ee54ef8..7725f33618 100644
--- a/packages/sheets-numfmt-ui/src/views/components/thousandth-percentile/index.tsx
+++ b/packages/sheets-numfmt-ui/src/views/components/thousandth-percentile/index.tsx
@@ -57,8 +57,8 @@ export const ThousandthPercentilePanel: FC<IBusinessComponentProps> = (props) =>
return (
<div>
- <div className="m-t-16 label">{localeService.t('sheet.numfmt.decimalLength')}</div>
- <div className="m-t-8">
+ <div className="univer-mt-4 univer-text-sm univer-text-gray-400">{localeService.t('sheet.numfmt.decimalLength')}</div>
+ <div className="univer-mt-2">
<InputNumber
disabled={isInputDisable}
value={decimal}
@@ -67,14 +67,16 @@ export const ThousandthPercentilePanel: FC<IBusinessComponentProps> = (props) =>
onChange={handleDecimalChange}
/>
</div>
- <div className="m-t-16 label">
+ <div className="univer-mt-4 univer-text-sm univer-text-gray-400">
{' '}
{localeService.t('sheet.numfmt.negType')}
</div>
- <div className="m-t-8">
+ <div className="univer-mt-2">
<SelectList onChange={handleClick} options={options} value={suffix} />
</div>
- <div className="describe m-t-14">{localeService.t('sheet.numfmt.thousandthPercentileDes')}</div>
+ <div className="univer-mt-3.5 univer-text-[13px]/5 univer-text-gray-600">
+ {localeService.t('sheet.numfmt.thousandthPercentileDes')}
+ </div>
</div>
);
};
diff --git a/packages/sheets-table-ui/src/views/components/SheetTableConditionPanel.tsx b/packages/sheets-table-ui/src/views/components/SheetTableConditionPanel.tsx
index 704ea2460c..cc709aa436 100644
--- a/packages/sheets-table-ui/src/views/components/SheetTableConditionPanel.tsx
+++ b/packages/sheets-table-ui/src/views/components/SheetTableConditionPanel.tsx
@@ -17,7 +17,7 @@
import type { ITableFilterItem } from '@univerjs/sheets-table';
import type { IConditionCompareTypeEnum, IConditionExpect, IConditionInfo, ITableConditionTypeEnumWithoutLogic } from './type';
import { dayjs, Injector, LocaleService } from '@univerjs/core';
-import { CascaderList, DatePicker, DateRangePicker, Input, InputNumber, Select } from '@univerjs/design';
+import { CascaderList, DatePicker, DateRangePicker, Input, InputNumber, LegacySelect, Select } from '@univerjs/design';
import { TableConditionTypeEnum, TableDateCompareTypeEnum, TableStringCompareTypeEnum } from '@univerjs/sheets-table';
import { useDependency } from '@univerjs/ui';
import { useState } from 'react';
@@ -90,8 +90,8 @@ export const SheetTableConditionPanel = (props: IConditionFilterProps) => {
return (
<div>
- <Select
- className="univer-h-8 univer-w-full"
+ <LegacySelect
+ key={version}
dropdownRender={() => (
<CascaderList
value={[conditionInfo.type, conditionInfo.compare!]}
@@ -102,8 +102,7 @@ export const SheetTableConditionPanel = (props: IConditionFilterProps) => {
/>
)}
value={selectType}
- onChange={() => { }}
- key={version}
+ onChange={() => {}}
/>
<div className="univer-mt-3 univer-w-full">
@@ -171,7 +170,7 @@ export const SheetTableConditionPanel = (props: IConditionFilterProps) => {
{subComponentType === ConditionSubComponentEnum.Inputs && (
<div className="univer-flex univer-items-center univer-gap-2">
<InputNumber
- className="univer-h-7 univer-w-full"
+ className="univer-w-full"
value={conditionInfo.info.numberRange?.[0]}
onChange={(v) => {
if (v !== null) {
@@ -182,7 +181,7 @@ export const SheetTableConditionPanel = (props: IConditionFilterProps) => {
/>
<span> - </span>
<InputNumber
- className="univer-h-7 univer-w-full"
+ className="univer-w-full"
value={conditionInfo.info.numberRange?.[1]}
controls={false}
onChange={(v) => {
@@ -195,10 +194,10 @@ export const SheetTableConditionPanel = (props: IConditionFilterProps) => {
)}
{!!(subComponentType === ConditionSubComponentEnum.Select) && (
<Select
+ className="univer-w-full"
value={conditionInfo.info.dateSelect ?? conditionDateOptions[0].value}
options={conditionDateOptions}
onChange={(v) => handleConditionInfo({ dateSelect: v })}
- className="univer-w-full"
/>
)}
</div>
diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx
index f42b347167..e9a62a6821 100644
--- a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx
+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx
@@ -18,7 +18,7 @@ import type { Nullable, Workbook } from '@univerjs/core';
import type { IDefinedNamesServiceParam } from '@univerjs/engine-formula';
import type { IRangeSelectorProps } from '../../basics/editor/range';
import { AbsoluteRefType, IUniverInstanceService, LocaleService, Tools, UniverInstanceType } from '@univerjs/core';
-import { Button, Input, Radio, RadioGroup, Select } from '@univerjs/design';
+import { Button, clsx, Input, Radio, RadioGroup, Select } from '@univerjs/design';
import { IDefinedNamesService, IFunctionService, isReferenceStrings, isReferenceStringWithEffectiveColumn, LexerTreeBuilder, operatorToken } from '@univerjs/engine-formula';
import { hasCJKText } from '@univerjs/engine-render';
import { ErrorSingle } from '@univerjs/icons';
@@ -26,7 +26,6 @@ import { SCOPE_WORKBOOK_VALUE_DEFINED_NAME } from '@univerjs/sheets';
import { ComponentManager, useDependency, useSidebarClick } from '@univerjs/ui';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, RANGE_SELECTOR_COMPONENT_KEY } from '../../common/keys';
-import styles from './index.module.less';
export interface IDefinedNameInputProps extends Omit<IDefinedNamesServiceParam, 'id'> {
inputId: string;
@@ -37,10 +36,6 @@ export interface IDefinedNameInputProps extends Omit<IDefinedNamesServiceParam,
id?: string;
}
-const widthStyle: React.CSSProperties = {
- width: '100%',
-};
-
export const DefinedNameInput = (props: IDefinedNameInputProps) => {
const {
inputId,
@@ -210,10 +205,18 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {
});
return (
- <div className={styles.definedNameInput} style={{ display: state ? 'block' : 'none' }}>
+ <div
+ className={clsx(`
+ univer-flex univer-flex-col univer-items-center univer-border-0 univer-border-b univer-border-solid
+ univer-border-gray-200 univer-pb-1
+ [&>div]:univer-mt-4 [&>div]:univer-w-full
+ `, {
+ 'univer-hidden': !state,
+ })}
+ >
<div>
<Input
- style={widthStyle}
+ className="univer-w-full"
placeholder={localeService.t('definedName.inputNamePlaceholder')}
value={nameValue}
allowClear
@@ -258,18 +261,28 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {
/>
))}
<div>
- <Select style={widthStyle} value={localSheetIdValue} options={options} onChange={setLocalSheetIdValue} />
+ <Select
+ className="univer-w-full"
+ value={localSheetIdValue}
+ options={options}
+ onChange={setLocalSheetIdValue}
+ />
</div>
<div>
<Input
- style={widthStyle}
+ className="univer-w-full"
placeholder={localeService.t('definedName.inputCommentPlaceholder')}
value={commentValue}
onChange={setCommentValue}
/>
</div>
- <div style={{ display: validString.length === 0 ? 'none' : 'flex' }} className={styles.definedNameInputValidation}>
- <span>
+ <div
+ className={clsx('univer-items-center univer-text-[13px] univer-text-red-500', {
+ 'univer-hidden': validString.length === 0,
+ 'univer-flex': validString.length !== 0,
+ })}
+ >
+ <span className="univer-mr-0.5">
{validString}
</span>
<ErrorSingle />
@@ -277,7 +290,7 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {
<div>
<Button
onClick={() => {
- cancel && cancel();
+ cancel?.();
}}
>
{localeService.t('definedName.cancel')}
diff --git a/packages/sheets-ui/src/views/defined-name/index.module.less b/packages/sheets-ui/src/views/defined-name/index.module.less
index af00dbeb20..d3cdefd0cd 100644
--- a/packages/sheets-ui/src/views/defined-name/index.module.less
+++ b/packages/sheets-ui/src/views/defined-name/index.module.less
@@ -204,17 +204,6 @@
}
&-input {
- display: flex;
- align-items: center;
- justify-content: left;
- border-bottom: 1px solid rgb(var(--border-color));
- padding-bottom: 5px;
-
- & > div {
- // check docs-ui/src/components/editor/index.module.less .text-editor-validation-error
- margin-top: 16px;
- }
-
// univer-defined-name-input
&-formula-selector-text-wrap {
margin-top: 16px;
@@ -233,18 +222,6 @@
user-select: none;
}
- &-validation {
- display: flex;
- align-items: center;
- justify-content: left;
- color: rgb(var(--error-color));
- font-size: var(--font-size-xs);
-
- & > span {
- margin-right: 2px;
- }
- }
-
&-disable {
color: rgb(var(--grey-200));
cursor: not-allowed;
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
index 402a5b7609..c8289b4c48 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
@@ -128,15 +128,15 @@ export const PermissionDetailUserPart = (props: IPermissionDetailUserPartProps)
<Select
className={styles.sheetPermissionDesignPersonPanelContentItemSelect}
value="edit"
+ options={[
+ { label: `${localeService.t('permission.panel.canEdit')}`, value: 'edit' },
+ { label: `${localeService.t('permission.panel.delete')}`, value: 'delete' },
+ ]}
onChange={(v) => {
if (v === 'delete') {
sheetPermissionUserManagerService.setSelectUserList(selectUserList.filter((i) => i.subject?.userID !== item.subject?.userID));
}
}}
- options={[
- { label: `${localeService.t('permission.panel.canEdit')}`, value: 'edit' },
- { label: `${localeService.t('permission.panel.delete')}`, value: 'delete' },
- ]}
/>
</div>
);
diff --git a/packages/thread-comment-ui/src/views/thread-comment-editor/index.module.less b/packages/thread-comment-ui/src/views/thread-comment-editor/index.module.less
deleted file mode 100644
index 78b94fc33c..0000000000
--- a/packages/thread-comment-ui/src/views/thread-comment-editor/index.module.less
+++ /dev/null
@@ -1,25 +0,0 @@
-.thread-comment-editor-buttons {
- margin-top: 12px;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
-}
-
-.thread-comment-editor-suggestion {
- display: flex;
- display: flex;
- align-items: center;
- font-size: 13px;
- color: rgb(var(--color-black));
-}
-
-.thread-comment-editor-suggestionActive {
- background-color: rgba(var(--grey-50));
-}
-
-.thread-comment-editor-suggestion-icon {
- width: 24px;
- height: 24px;
- border-radius: 12px;
- margin-right: 6px;
-}
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.tsx
index 0f928871da..98c4ca0c42 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
@@ -21,9 +21,8 @@ import { BuildTextUtils, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Locale
import { Button, clsx } from '@univerjs/design';
import { BreakLineCommand, IEditorService, RichTextEditor } from '@univerjs/docs-ui';
import { KeyCode, useDependency } from '@univerjs/ui';
-import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
+import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { SetActiveCommentOperation } from '../../commands/operations/comment.operations';
-import styles from './index.module.less';
export interface IThreadCommentEditorProps {
id?: string;
@@ -112,11 +111,11 @@ export const ThreadCommentEditor = forwardRef<IThreadCommentEditorInstance, IThr
};
return (
- <div className={styles.threadCommentEditor} onClick={(e) => e.preventDefault()}>
+ <div onClick={(e) => e.preventDefault()}>
<RichTextEditor
+ className="univer-w-full"
editorRef={editor}
autoFocus={autoFocus}
- style={{ width: '100%' }}
keyboardEventConfig={keyboardEventConfig}
placeholder={localeService.t('threadCommentUI.editor.placeholder')}
initialValue={comment?.text && getSnapshot(comment.text)}
@@ -160,11 +159,15 @@ export const ThreadCommentEditor = forwardRef<IThreadCommentEditorInstance, IThr
export const ThreadCommentSuggestion = ({ active, user }: { active: boolean; user: IUser }) => (
<div
className={clsx(
- 'univer-flex univer-items-center univer-text-sm univer-text-black',
+ 'univer-flex univer-items-center univer-text-sm univer-text-gray-900',
{ 'univer-bg-gray-50': active }
)}
>
- <img draggable={false} className="univer-mr-[6px] univer-h-6 univer-w-6 univer-rounded-full" src={user.avatar} />
+ <img
+ className="univer-mr-1.5 univer-h-6 univer-w-6 univer-rounded-full"
+ src={user.avatar}
+ draggable={false}
+ />
<span>{user.name}</span>
</div>
);
diff --git a/packages/thread-comment-ui/src/views/thread-comment-panel/index.module.less b/packages/thread-comment-ui/src/views/thread-comment-panel/index.module.less
deleted file mode 100644
index c4602f09a9..0000000000
--- a/packages/thread-comment-ui/src/views/thread-comment-panel/index.module.less
+++ /dev/null
@@ -1,46 +0,0 @@
-.thread-comment-panel {
- min-height: 100%;
- display: flex;
- flex-direction: column;
- padding-bottom: 12px;
-
- .thread-comment {
- margin-top: 12px;
- }
-
- &-forms {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- margin-top: 12px;
-
- .select {
- width: 120px;
- }
- }
-
- &-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: rgb(var(--grey-600));
- font-size: 13px;
- flex: 1;
- }
-
- &-add {
- margin-top: 8px;
- display: flex;
- flex-direction: row;
-
- svg {
- margin-right: 6px;
- }
- }
-
- &-solved {
- margin-top: 12px;
- font-size: var(--font-size-xs);
- }
-}
diff --git a/packages/thread-comment-ui/src/views/thread-comment-panel/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-panel/index.tsx
index 31b7452893..2c72e9eea7 100644
--- a/packages/thread-comment-ui/src/views/thread-comment-panel/index.tsx
+++ b/packages/thread-comment-ui/src/views/thread-comment-panel/index.tsx
@@ -23,7 +23,7 @@ import { Button, Select } from '@univerjs/design';
import { IncreaseSingle } from '@univerjs/icons';
import { ThreadCommentModel } from '@univerjs/thread-comment';
import { useDependency, useObservable } from '@univerjs/ui';
-import React, { useEffect, useMemo, useRef, useState } from 'react';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { SetActiveCommentOperation } from '../../commands/operations/comment.operations';
import { ThreadCommentPanelService } from '../../services/thread-comment-panel.service';
import { ThreadCommentTree } from '../thread-comment-tree';
@@ -203,7 +203,6 @@ export const ThreadCommentPanel = (props: IThreadCommentPanelProps) => {
<Select
borderless
value={unit}
- onChange={(e) => setUnit(e)}
options={[
{
value: 'current',
@@ -214,13 +213,13 @@ export const ThreadCommentPanel = (props: IThreadCommentPanelProps) => {
label: localeService.t('threadCommentUI.filter.sheet.all'),
},
]}
+ onChange={setUnit}
/>
)
: null}
<Select
borderless
value={status}
- onChange={(e) => setStatus(e)}
options={[
{
value: 'all',
@@ -239,6 +238,7 @@ export const ThreadCommentPanel = (props: IThreadCommentPanelProps) => {
label: localeService.t('threadCommentUI.filter.status.concernMe'),
},
]}
+ onChange={setStatus}
/>
</div>
{renderComments.length === 0
@@ -262,7 +262,7 @@ export const ThreadCommentPanel = (props: IThreadCommentPanelProps) => {
? (
<div className="univer-mt-2 univer-flex univer-flex-row">
<Button onClick={onAdd}>
- <IncreaseSingle className="univer-mr-[6px]" />
+ <IncreaseSingle className="univer-mr-1.5" />
{localeService.t('threadCommentUI.panel.add')}
</Button>
</div>
diff --git a/packages/thread-comment-ui/src/views/thread-comment-tree/index.module.less b/packages/thread-comment-ui/src/views/thread-comment-tree/index.module.less
deleted file mode 100644
index 3fa74a5596..0000000000
--- a/packages/thread-comment-ui/src/views/thread-comment-tree/index.module.less
+++ /dev/null
@@ -1,152 +0,0 @@
-.thread-comment {
- padding: 16px;
- background: rgba(var(--color-white));
- border: 1px solid rgba(var(--grey-200));
- border-radius: 8px;
- box-sizing: border-box;
- position: relative;
- width: 278px;
-}
-
-.thread-comment-active {
- box-shadow: var(--box-shadow-base);
-}
-
-.thread-comment-content {
- max-height: 300px;
- overflow-y: auto;
- overflow-x: hidden;
- scrollbar-color: rgba(var(--scrollbar-color), 0.7) transparent;
- scrollbar-gutter: auto;
- scrollbar-width: thin;
-}
-
-.thread-comment-highlight {
- background-color: rgb(var(--gold-400));
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 6px;
- border-top-left-radius: 6px;
- border-top-right-radius: 6px;
-}
-
-.thread-comment-icon-container {
- display: flex;
- flex-direction: row;
- flex-shrink: 0;
- flex-grow: 0;
-}
-
-.thread-comment-icon {
- width: 24px;
- height: 24px;
- border-radius: 3px;
- margin-left: 4px;
- display: inline-flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- font-size: 16px;
-}
-
-.thread-comment-icon:hover {
- background-color: rgba(var(--grey-50));
-}
-
-.thread-comment-title {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 16px;
- font-size: 14px;
- line-height: 20px;
-}
-
-.thread-comment-title-position {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex: 1 1 0;
- overflow: hidden;
-}
-
-.thread-comment-title-highlight {
- width: 3px;
- height: 14px;
- border-radius: 1.5px;
- background-color: rgba(var(--gold-400));
- margin-right: 8px;
- flex-shrink: 0;
- flex-grow: 0;
-}
-
-.thread-comment-title-position-text {
- flex: 1 1 0;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
-}
-
-.thread-comment-username {
- font-size: 14px;
- font-weight: 500;
- line-height: 20px;
-}
-
-.thread-comment-item {
- margin-bottom: 12px;
- padding-left: 30px;
- position: relative;
-}
-
-.thread-comment-item-head {
- width: 24px;
- height: 24px;
- border-radius: 12px;
- position: absolute;
- left: 0;
- top: 0;
-}
-
-.thread-comment-item-title {
- display: flex;
- justify-content: space-between;
- height: 24px;
- align-items: center;
- margin-bottom: 4px;
-
- &-position {
- color: rgba(var(--color-black));
- font-size: 14px;
- line-height: 20px;
- }
-
- &-highlight {
- width: 3px;
- height: 14px;
- border-radius: 2px;
- margin-right: 8px;
- margin-top: 3px;
- background-color: rgba(var(--gold-400));
- }
-}
-
-.thread-comment-item-time {
- font-size: 12px;
- line-height: 1.5;
- margin-bottom: 4px;
- color: rgba(var(--grey-600));
-}
-
-.thread-comment-item-content {
- font-size: 13px;
- line-height: 20px;
- color: rgba(var(--color-black));
-}
-
-.thread-comment-item-at {
- color: rgba(var(--blue-400));
-}
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.tsx
index f668842464..d2d987ea94 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
@@ -127,7 +127,7 @@ const ThreadCommentItem = (props: IThreadCommentItemProps) => {
className={`
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
+ univer-rounded-sm univer-text-base
hover:univer-bg-gray-50
`}
onClick={() => onReply(user)}
@@ -215,14 +215,14 @@ const ThreadCommentItem = (props: IThreadCommentItemProps) => {
/>
)
: (
- <div className="univer-text-[13px] univer-leading-5 univer-text-black">
+ <div className="univer-text-[13px] univer-leading-5 univer-text-gray-900">
{transformDocument2TextNodes(item.text).map((paragraph, i) => (
<div key={i} className="univer-break-words">
{paragraph.map((item, i) => {
switch (item.type) {
case 'mention':
return (
- <a className="univer-text-blue-600" key={i}>
+ <a className="univer-text-primary-600" key={i}>
{item.content.label}
{' '}
</a>
@@ -367,8 +367,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
? (
<div
className={`
- univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-[6px]
- univer-rounded-t-[6px] univer-bg-yellow-400
+ univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
+ univer-bg-yellow-400
`}
/>
)
@@ -382,8 +382,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
<div className="univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden">
<div
className={`
- univer-mr-2 univer-h-[14px] univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
- univer-rounded-[1.5px] univer-bg-yellow-400
+ univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
+ univer-rounded-sm univer-bg-yellow-400
`}
/>
<Tooltip showIfEllipsis title={title}>
@@ -434,12 +434,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
: null}
</div>
<div
- className={`
- univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden
- [scrollbar-gutter:auto]
- [scrollbar-width:thin]
- `}
ref={scroller}
+ className="univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden"
>
{renderComments.map(
(item) => (
diff --git a/packages/ui/src/views/workbench/Workbench.tsx b/packages/ui/src/views/workbench/Workbench.tsx
index ef29241957..ed90556ca7 100644
--- a/packages/ui/src/views/workbench/Workbench.tsx
+++ b/packages/ui/src/views/workbench/Workbench.tsx
@@ -79,6 +79,12 @@ export function DesktopWorkbenchContent(props: IUniverWorkbenchProps) {
useEffect(() => {
const sub = themeService.darkMode$.subscribe((darkMode) => {
setDarkMode(darkMode);
+
+ if (darkMode) {
+ document.documentElement.classList.add('univer-dark');
+ } else {
+ document.documentElement.classList.remove('univer-dark');
+ }
});
return () => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bd0dc228d9..1d918067c4 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1129,8 +1129,8 @@ importers:
packages/design:
dependencies:
'@radix-ui/react-dialog':
- specifier: '^1.1.1 '
+ specifier: ^1.1.11
'@radix-ui/react-dropdown-menu':
specifier: ^2.1.12
@@ -4611,8 +4611,8 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-m6pZb0gEM5uHPSb+i2nKKGQi/HMSVjARMsLMWQfKDP+eJ6B+uqryHnXhpnohTWElw+vEcMk/o4wJODtdRKHwqg==}
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-yI7S1ipkP5/+99qhSI6nthfo/tR6bL6Zgxi/+1UO6qPa6UeM6nlafWcQ65vB4rU2XjgjMfMhI3k9Y5MztA62VQ==}
peerDependencies:
'@types/react': '19'
'@types/react-dom': '19'
@@ -4742,19 +4742,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-IrVLIhskYhH3nLvtcBLQFZr61tBG7wx7O3kEmdzcYwRGAEBmBicGGL7ATzNgruYJ3xBTbuzEEq9OXJM3PAX3tA==}
- peerDependencies:
- '@types/react': '19'
- '@types/react-dom': '19'
- react: '19'
- react-dom: '19'
- peerDependenciesMeta:
- '@types/react':
- optional: true
- '@types/react-dom':
- optional: true
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-ueDqRbdc4/bkaQT3GIpLQssRlFgWaL/U2z/S31qRwwLWoxHLgry3SIfCwhxeQNbirEUXFa+lq3RL3oBYXtcmIA==}
peerDependencies:
@@ -12638,7 +12625,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.1.2
dependencies:
'@radix-ui/primitive': 1.1.2
'@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
@@ -12648,7 +12635,7 @@ snapshots:
'@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
'@radix-ui/react-slot': 1.2.0(@types/[email protected])([email protected])
'@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
@@ -12795,16 +12782,6 @@ snapshots:
'@types/react': 19.1.2
'@types/react-dom': 19.1.2(@types/[email protected])
- dependencies:
- '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
- '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
- react: 19.0.0
- react-dom: 19.0.0([email protected])
- optionalDependencies:
- '@types/react': 19.1.2
- '@types/react-dom': 19.1.2(@types/[email protected])
-
dependencies:
'@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])