mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(core): guard service (#9816)
This commit is contained in:
@@ -39,7 +39,6 @@ export const button = style({
|
||||
outline: 0,
|
||||
borderRadius: 8,
|
||||
transition: 'all .3s',
|
||||
cursor: 'pointer',
|
||||
['WebkitAppRegion' as string]: 'no-drag',
|
||||
|
||||
// hover layer
|
||||
@@ -169,6 +168,10 @@ export const button = style({
|
||||
opacity: 0.5,
|
||||
},
|
||||
|
||||
'&:not([data-disabled])': {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
|
||||
// default keyboard focus style
|
||||
'&:focus-visible::after': {
|
||||
content: '""',
|
||||
|
||||
@@ -316,7 +316,11 @@ export const useDropTarget = <D extends DNDData = DNDData>(
|
||||
|
||||
// external data is only available in drop event thus
|
||||
// this is the only case for getAdaptedEventArgs
|
||||
const args = getAdaptedEventArgs(_args, options.fromExternalData, true);
|
||||
const args = {
|
||||
...getAdaptedEventArgs(_args, options.fromExternalData, true),
|
||||
treeInstruction: extractInstruction(_args.self.data),
|
||||
closestEdge: extractClosestEdge(_args.self.data),
|
||||
};
|
||||
if (
|
||||
isExternalDrag(_args) &&
|
||||
options.fromExternalData &&
|
||||
@@ -329,11 +333,7 @@ export const useDropTarget = <D extends DNDData = DNDData>(
|
||||
}
|
||||
|
||||
if (args.location.current.dropTargets[0]?.element === element) {
|
||||
options.onDrop?.({
|
||||
...args,
|
||||
treeInstruction: extractInstruction(args.self.data),
|
||||
closestEdge: extractClosestEdge(args.self.data),
|
||||
} as DropTargetDropEvent<D>);
|
||||
options.onDrop?.(args as DropTargetDropEvent<D>);
|
||||
}
|
||||
},
|
||||
getData: (args: DropTargetGetFeedback<D>) => {
|
||||
|
||||
@@ -51,7 +51,7 @@ export const menuItem = style({
|
||||
'&.block': {
|
||||
maxWidth: '100%',
|
||||
},
|
||||
'&[data-disabled]': {
|
||||
'&[data-disabled], &.disabled': {
|
||||
vars: {
|
||||
[iconColor]: cssVarV2('icon/disable'),
|
||||
[labelColor]: cssVarV2('text/secondary'),
|
||||
|
||||
@@ -16,13 +16,15 @@ export const useMenuItem = <T extends MenuItemProps>({
|
||||
checked,
|
||||
selected,
|
||||
block,
|
||||
disabled,
|
||||
...otherProps
|
||||
}: T) => {
|
||||
const className = clsx(
|
||||
styles.menuItem,
|
||||
{
|
||||
danger: type === 'danger',
|
||||
warning: type === 'warning',
|
||||
danger: disabled ? false : type === 'danger',
|
||||
warning: disabled ? false : type === 'warning',
|
||||
disabled,
|
||||
checked,
|
||||
selected,
|
||||
block,
|
||||
|
||||
@@ -133,10 +133,12 @@ export const propertyValueContainer = style({
|
||||
'&[data-readonly="false"][data-hoverable="true"]': {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
'&[data-readonly="false"][data-hoverable="true"]:is(:hover, :focus-within)':
|
||||
{
|
||||
backgroundColor: cssVarV2('layer/background/hoverOverlay'),
|
||||
},
|
||||
'&[data-readonly="true"][data-hoverable="true"]': {
|
||||
cursor: 'default',
|
||||
},
|
||||
'&[data-hoverable="true"]:is(:hover, :focus-within)': {
|
||||
backgroundColor: cssVarV2('layer/background/hoverOverlay'),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ export const RadioGroup = memo(function RadioGroup({
|
||||
indicatorStyle,
|
||||
iconMode,
|
||||
onChange,
|
||||
disabled,
|
||||
}: RadioProps) {
|
||||
const animationTImerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const finalItems = useMemo(() => {
|
||||
@@ -158,6 +159,7 @@ export const RadioGroup = memo(function RadioGroup({
|
||||
className={clsx(styles.radioButtonGroup, className)}
|
||||
style={finalStyle}
|
||||
data-icon-mode={iconMode}
|
||||
disabled={disabled}
|
||||
>
|
||||
{finalItems.map(({ customRender, ...item }, index) => {
|
||||
const testId = item.testId ? { 'data-testid': item.testId } : {};
|
||||
@@ -179,6 +181,7 @@ export const RadioGroup = memo(function RadioGroup({
|
||||
style={style}
|
||||
{...testId}
|
||||
{...item.attrs}
|
||||
disabled={disabled}
|
||||
>
|
||||
<RadixRadioGroup.Indicator
|
||||
forceMount
|
||||
|
||||
@@ -25,7 +25,7 @@ export const radioButton = style({
|
||||
'&[data-state="checked"]': {
|
||||
color: cssVarV2('switch/fontColor/primary'),
|
||||
},
|
||||
'&[data-state="unchecked"]:hover': {
|
||||
'&[data-state="unchecked"]:hover:not([disabled])': {
|
||||
background: cssVarV2('switch/buttonBackground/hover'),
|
||||
},
|
||||
'[data-icon-mode=true] &': {
|
||||
|
||||
Reference in New Issue
Block a user