@canlooks/can-ui 0.0.65 → 0.0.66

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.
@@ -31,7 +31,7 @@ const Button = ({ component: Component = 'button', color = 'primary', shape = 's
31
31
  ? actualPrefix
32
32
  ? (0, jsx_runtime_1.jsx)(loadingIndicator_1.LoadingIndicator, { color: reverseTextColor })
33
33
  : (0, jsx_runtime_1.jsx)(transitionBase_1.Collapse, { orientation: "horizontal", in: true, children: (0, jsx_runtime_1.jsx)(loadingIndicator_1.LoadingIndicator, { color: reverseTextColor }) })
34
- : actualPrefix, !!actualChildren &&
34
+ : (0, jsx_runtime_1.jsx)("div", { className: button_style_1.classes.prefix, children: actualPrefix }), !!actualChildren &&
35
35
  (0, jsx_runtime_1.jsx)("div", { className: button_style_1.classes.content, children: actualChildren }), !!suffix &&
36
36
  (0, jsx_runtime_1.jsx)("div", { className: button_style_1.classes.suffix, children: suffix })] }));
37
37
  };
@@ -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
  }
@@ -358,7 +358,12 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
358
358
  const hoverable = triggersSet.has('hover');
359
359
  const enterTimeout = (0, react_1.useRef)(void 0);
360
360
  const leaveTimeout = (0, react_1.useRef)(void 0);
361
- const pointerEnter = (e) => {
361
+ const isEntered = (0, react_1.useRef)(false);
362
+ const pointerEnter = () => {
363
+ if (isEntered.current) {
364
+ return;
365
+ }
366
+ isEntered.current = true;
362
367
  hold(true);
363
368
  clearTimeout(enterTimeout.current);
364
369
  mouseEnterDelay
@@ -366,6 +371,7 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
366
371
  : setInnerOpen(true);
367
372
  };
368
373
  const pointerLeave = () => {
374
+ isEntered.current = false;
369
375
  hold(false);
370
376
  clearTimeout(leaveTimeout.current);
371
377
  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
  };
@@ -28,7 +28,7 @@ export const Button = ({ component: Component = 'button', color = 'primary', sha
28
28
  ? actualPrefix
29
29
  ? _jsx(LoadingIndicator, { color: reverseTextColor })
30
30
  : _jsx(Collapse, { orientation: "horizontal", in: true, children: _jsx(LoadingIndicator, { color: reverseTextColor }) })
31
- : actualPrefix, !!actualChildren &&
31
+ : _jsx("div", { className: classes.prefix, children: actualPrefix }), !!actualChildren &&
32
32
  _jsx("div", { className: classes.content, children: actualChildren }), !!suffix &&
33
33
  _jsx("div", { className: classes.suffix, children: suffix })] }));
34
34
  };
@@ -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
  }
@@ -355,7 +355,12 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
355
355
  const hoverable = triggersSet.has('hover');
356
356
  const enterTimeout = useRef(void 0);
357
357
  const leaveTimeout = useRef(void 0);
358
- const pointerEnter = (e) => {
358
+ const isEntered = useRef(false);
359
+ const pointerEnter = () => {
360
+ if (isEntered.current) {
361
+ return;
362
+ }
363
+ isEntered.current = true;
359
364
  hold(true);
360
365
  clearTimeout(enterTimeout.current);
361
366
  mouseEnterDelay
@@ -363,6 +368,7 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
363
368
  : setInnerOpen(true);
364
369
  };
365
370
  const pointerLeave = () => {
371
+ isEntered.current = false;
366
372
  hold(false);
367
373
  clearTimeout(leaveTimeout.current);
368
374
  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.66",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",