@canlooks/can-ui 0.0.65 → 0.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,7 @@ exports.style = (0, utils_1.defineCss)(({ spacing, mode, gray, text, colors, eas
23
23
  min-height: 0;
24
24
 
25
25
  .${loading_style_1.classes.container} {
26
+ height: auto;
26
27
  display: flex;
27
28
  flex-direction: column;
28
29
  }
@@ -38,7 +38,6 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
38
38
  const unmounted = (0, utils_1.useUnmounted)();
39
39
  const openHolding = (0, react_1.useRef)(0);
40
40
  const hold = (open) => {
41
- console.log('hold', open);
42
41
  return open ? ++openHolding.current
43
42
  : openHolding.current > 0 ? --openHolding.current
44
43
  : openHolding.current;
@@ -358,7 +357,12 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
358
357
  const hoverable = triggersSet.has('hover');
359
358
  const enterTimeout = (0, react_1.useRef)(void 0);
360
359
  const leaveTimeout = (0, react_1.useRef)(void 0);
361
- const pointerEnter = (e) => {
360
+ const isEntered = (0, react_1.useRef)(false);
361
+ const pointerEnter = () => {
362
+ if (isEntered.current) {
363
+ return;
364
+ }
365
+ isEntered.current = true;
362
366
  hold(true);
363
367
  clearTimeout(enterTimeout.current);
364
368
  mouseEnterDelay
@@ -366,6 +370,7 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
366
370
  : setInnerOpen(true);
367
371
  };
368
372
  const pointerLeave = () => {
373
+ isEntered.current = false;
369
374
  hold(false);
370
375
  clearTimeout(leaveTimeout.current);
371
376
  mouseLeaveDelay
@@ -3,18 +3,18 @@ import { DivProps } from '../../types';
3
3
  import { ButtonProps } from '../button';
4
4
  import { DropArea } from './dropArea';
5
5
  export type UploadStatus = 'default' | 'uploading' | 'success' | 'error';
6
- export interface UploadFile<R, A extends any[]> extends File {
6
+ export interface UploadFile<R = any, A extends any[] = any[]> extends File {
7
7
  id: string;
8
8
  progress?: number;
9
9
  status?: UploadStatus;
10
10
  url?: string;
11
11
  upload?(...args: A): Promise<R | undefined>;
12
12
  }
13
- export interface UploadSharedProps<R, A extends any[]> {
13
+ export interface UploadSharedProps<R = any, A extends any[] = any[]> {
14
14
  type?: 'file' | 'image';
15
15
  onUpload?(files: UploadFile<R, A>[], setProgress: Dispatch<SetStateAction<number>>, ...args: A): Promise<R>;
16
16
  }
17
- export interface UploadProps<R, A extends any[]> extends UploadSharedProps<R, A>, Omit<DivProps, 'defaultValue' | 'onChange'> {
17
+ export interface UploadProps<R = any, A extends any[] = any[]> extends UploadSharedProps<R, A>, Omit<DivProps, 'defaultValue' | 'onChange'> {
18
18
  inputProps?: JSX.IntrinsicElements['input'];
19
19
  accept?: string;
20
20
  max?: number;
@@ -40,6 +40,6 @@ export interface UploadRef<R = any, A extends any[] = any[]> extends HTMLDivElem
40
40
  upload(...args: A): Promise<R | undefined>;
41
41
  }
42
42
  export declare const Upload: {
43
- <R, A extends any[]>(props: UploadProps<R, A>): ReactElement;
43
+ <R = any, A extends any[] = any[]>(props: UploadProps<R, A>): ReactElement;
44
44
  DropArea: typeof DropArea;
45
45
  };
@@ -20,6 +20,7 @@ export const style = defineCss(({ spacing, mode, gray, text, colors, easing }) =
20
20
  min-height: 0;
21
21
 
22
22
  .${loadingClasses.container} {
23
+ height: auto;
23
24
  display: flex;
24
25
  flex-direction: column;
25
26
  }
@@ -35,7 +35,6 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
35
35
  const unmounted = useUnmounted();
36
36
  const openHolding = useRef(0);
37
37
  const hold = (open) => {
38
- console.log('hold', open);
39
38
  return open ? ++openHolding.current
40
39
  : openHolding.current > 0 ? --openHolding.current
41
40
  : openHolding.current;
@@ -355,7 +354,12 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
355
354
  const hoverable = triggersSet.has('hover');
356
355
  const enterTimeout = useRef(void 0);
357
356
  const leaveTimeout = useRef(void 0);
358
- const pointerEnter = (e) => {
357
+ const isEntered = useRef(false);
358
+ const pointerEnter = () => {
359
+ if (isEntered.current) {
360
+ return;
361
+ }
362
+ isEntered.current = true;
359
363
  hold(true);
360
364
  clearTimeout(enterTimeout.current);
361
365
  mouseEnterDelay
@@ -363,6 +367,7 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
363
367
  : setInnerOpen(true);
364
368
  };
365
369
  const pointerLeave = () => {
370
+ isEntered.current = false;
366
371
  hold(false);
367
372
  clearTimeout(leaveTimeout.current);
368
373
  mouseLeaveDelay
@@ -3,18 +3,18 @@ import { DivProps } from '../../types';
3
3
  import { ButtonProps } from '../button';
4
4
  import { DropArea } from './dropArea';
5
5
  export type UploadStatus = 'default' | 'uploading' | 'success' | 'error';
6
- export interface UploadFile<R, A extends any[]> extends File {
6
+ export interface UploadFile<R = any, A extends any[] = any[]> extends File {
7
7
  id: string;
8
8
  progress?: number;
9
9
  status?: UploadStatus;
10
10
  url?: string;
11
11
  upload?(...args: A): Promise<R | undefined>;
12
12
  }
13
- export interface UploadSharedProps<R, A extends any[]> {
13
+ export interface UploadSharedProps<R = any, A extends any[] = any[]> {
14
14
  type?: 'file' | 'image';
15
15
  onUpload?(files: UploadFile<R, A>[], setProgress: Dispatch<SetStateAction<number>>, ...args: A): Promise<R>;
16
16
  }
17
- export interface UploadProps<R, A extends any[]> extends UploadSharedProps<R, A>, Omit<DivProps, 'defaultValue' | 'onChange'> {
17
+ export interface UploadProps<R = any, A extends any[] = any[]> extends UploadSharedProps<R, A>, Omit<DivProps, 'defaultValue' | 'onChange'> {
18
18
  inputProps?: JSX.IntrinsicElements['input'];
19
19
  accept?: string;
20
20
  max?: number;
@@ -40,6 +40,6 @@ export interface UploadRef<R = any, A extends any[] = any[]> extends HTMLDivElem
40
40
  upload(...args: A): Promise<R | undefined>;
41
41
  }
42
42
  export declare const Upload: {
43
- <R, A extends any[]>(props: UploadProps<R, A>): ReactElement;
43
+ <R = any, A extends any[] = any[]>(props: UploadProps<R, A>): ReactElement;
44
44
  DropArea: typeof DropArea;
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",