Merge to master (#445)

* Fix/venus spanish (#423)

fix: update venus spanish language

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>

* fix: can not convert url text to link after paste

* fix: double link icon size error

* feat(code): enhance markdown parse code

* fix(code): add robust

* fix: remove special menu

* chore: clean code

* fix: ime with command menu

* fix(code): langs[lang] is not a function

* fix: can't add image and delete more action button (#430)

* feat: add zh_Hant for venus (#431)

* fix: lang select in  code block is insanity

* GitHub Doc Updates (#421)

* Update types-of-contributions.md

* Update README.md

Tidy up links section

* fix: inline menu position (#433)

* Master (#436)

* Fix/venus spanish (#423) (#425)

fix: update venus spanish language

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>

* Merge to master (#435)

* Fix/venus spanish (#423)

fix: update venus spanish language

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>

* fix: can not convert url text to link after paste

* fix: double link icon size error

* feat(code): enhance markdown parse code

* fix(code): add robust

* fix: remove special menu

* chore: clean code

* fix: ime with command menu

* fix(code): langs[lang] is not a function

* fix: can't add image and delete more action button (#430)

* feat: add zh_Hant for venus (#431)

* fix: lang select in  code block is insanity

* GitHub Doc Updates (#421)

* Update types-of-contributions.md

* Update README.md

Tidy up links section

* fix: inline menu position (#433)

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com>
Co-authored-by: tzhangchi <terry.zhangchi@outlook.com>
Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Co-authored-by: DiamondThree <diamond.shx@gmail.com>
Co-authored-by: CJSS <CJSS@users.noreply.github.com>
Co-authored-by: Qi <474021214@qq.com>

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com>
Co-authored-by: tzhangchi <terry.zhangchi@outlook.com>
Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Co-authored-by: DiamondThree <diamond.shx@gmail.com>
Co-authored-by: CJSS <CJSS@users.noreply.github.com>
Co-authored-by: Qi <474021214@qq.com>

* fix: close select popover after mouse leave code block

* docs: add jobs

* docs: update job docs structure

* fix: typo

* Update affine.pro.md

* Update affine.pro.md

* Update affine.pro.md

* feat: add Serbian language to venus (#441)

* refactor: redesign loading workspace db

* chore: remove unuse site logic

* feat: affine-embed-header

* Update affine.pro.md

* feat: add German language to venus (#443)

* fix: connection state

* refactor: jd

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com>
Co-authored-by: tzhangchi <terry.zhangchi@outlook.com>
Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Co-authored-by: DiamondThree <diamond.shx@gmail.com>
Co-authored-by: CJSS <CJSS@users.noreply.github.com>
Co-authored-by: Qi <474021214@qq.com>
Co-authored-by: DarkSky <darksky2048@gmail.com>
Co-authored-by: HeJiachen-PM <79301703+HeJiachen-PM@users.noreply.github.com>
This commit is contained in:
zuomeng wang
2022-09-21 15:45:40 +08:00
committed by GitHub
parent c010e05023
commit ef707b95ef
18 changed files with 194 additions and 55 deletions
+9 -5
View File
@@ -5,6 +5,7 @@ import {
type ForwardedRef,
type ReactNode,
type RefAttributes,
useEffect,
} from 'react';
/* eslint-disable no-restricted-imports */
import SelectUnstyled, {
@@ -15,13 +16,13 @@ import SelectUnstyled, {
import PopperUnstyled from '@mui/base/PopperUnstyled';
import { ArrowDropDownIcon } from '@toeverything/components/icons';
import { styled } from '../styled';
type ExtendSelectProps = {
// Width is always used custom, it will be set to root button and popover
width?: number | string;
style?: CSSProperties;
listboxStyle?: CSSProperties;
placeholder?: ReactNode;
open?: boolean;
};
/**
@@ -40,7 +41,6 @@ export const Select = forwardRef(function CustomSelect<TValue>(
props: ExtendSelectProps & SelectUnstyledProps<TValue>,
ref: ForwardedRef<HTMLUListElement>
) {
const [isOpen, setIsOpen] = useState(false);
const {
width = '100%',
style,
@@ -48,7 +48,11 @@ export const Select = forwardRef(function CustomSelect<TValue>(
placeholder,
onListboxOpenChange,
onChange,
open: propsOpen,
} = props;
const openControlledByProps = propsOpen !== undefined;
const [isOpen, setIsOpen] = useState(false);
const components: SelectUnstyledProps<TValue>['components'] = {
// Root: generateStyledRoot({ width, ...style }),
Root: forwardRef((rootProps, rootRef) => {
@@ -88,13 +92,13 @@ export const Select = forwardRef(function CustomSelect<TValue>(
return (
<SelectUnstyled
{...props}
listboxOpen={isOpen}
listboxOpen={openControlledByProps ? propsOpen : isOpen}
onListboxOpenChange={open => {
setIsOpen(open);
!openControlledByProps && setIsOpen(open);
onListboxOpenChange?.(open);
}}
onChange={v => {
setIsOpen(false);
!openControlledByProps && setIsOpen(false);
onChange?.(v);
}}
ref={ref}