@react-fabric/core 1.0.0-beta.57 → 1.0.0-beta.58
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.
- package/css/components/_icon.css +3 -3
- package/dist/cjs/components/avatar/Avatar.js +1 -0
- package/dist/cjs/components/badge/Badge.js +2 -10
- package/dist/cjs/components/button/Button.js +4 -11
- package/dist/cjs/components/chip/Chip.js +5 -12
- package/dist/cjs/components/icon/Icon.js +28 -3
- package/dist/cjs/components/menu/MenuItem.js +5 -12
- package/dist/cjs/components/panel/Panel.js +4 -13
- package/dist/cjs/components/tabpanel/Tab.js +3 -12
- package/dist/cjs/core/aside/Aside.js +2 -11
- package/dist/cjs/core/headfoot/HeadFoot.js +4 -2
- package/dist/cjs/core/page/Page.js +4 -13
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/overlays/alert/Alert.js +3 -1
- package/dist/cjs/overlays/flyout/Flyout.js +4 -11
- package/dist/cjs/overlays/message/Message.js +2 -0
- package/dist/cjs/overlays/modal/Modal.js +4 -11
- package/dist/cjs/overlays/toast/Toast.js +3 -1
- package/dist/cjs/types/icons.js +2 -1
- package/dist/esm/components/avatar/Avatar.js +1 -0
- package/dist/esm/components/badge/Badge.js +3 -11
- package/dist/esm/components/button/Button.js +6 -13
- package/dist/esm/components/chip/Chip.js +6 -13
- package/dist/esm/components/icon/Icon.js +30 -6
- package/dist/esm/components/menu/MenuItem.js +6 -13
- package/dist/esm/components/panel/Panel.js +5 -14
- package/dist/esm/components/tabpanel/Tab.js +4 -13
- package/dist/esm/core/aside/Aside.js +3 -12
- package/dist/esm/core/headfoot/HeadFoot.js +4 -2
- package/dist/esm/core/page/Page.js +5 -14
- package/dist/esm/index.js +1 -1
- package/dist/esm/overlays/alert/Alert.js +3 -1
- package/dist/esm/overlays/flyout/Flyout.js +5 -12
- package/dist/esm/overlays/message/Message.js +2 -0
- package/dist/esm/overlays/modal/Modal.js +5 -12
- package/dist/esm/overlays/toast/Toast.js +3 -1
- package/dist/esm/types/icons.js +2 -1
- package/dist/types/components/badge/Badge.d.ts +8 -3
- package/dist/types/components/button/Button.d.ts +8 -3
- package/dist/types/components/chip/Chip.d.ts +8 -3
- package/dist/types/components/icon/Icon.d.ts +10 -4
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/components/menu/types.d.ts +7 -2
- package/dist/types/components/panel/Panel.d.ts +8 -5
- package/dist/types/components/tabpanel/Tab.d.ts +8 -5
- package/dist/types/core/aside/Aside.d.ts +8 -5
- package/dist/types/core/page/Page.d.ts +8 -5
- package/dist/types/overlays/alert/Alert.d.ts +15 -3
- package/dist/types/overlays/flyout/Flyout.d.ts +5 -5
- package/dist/types/overlays/message/Message.d.ts +15 -3
- package/dist/types/overlays/modal/Modal.d.ts +5 -5
- package/dist/types/overlays/toast/Toast.d.ts +15 -3
- package/dist/types/types/icons.d.ts +2 -1
- package/dist/types/types/index.d.ts +0 -18
- package/package.json +14 -14
- package/src/components/avatar/Avatar.tsx +1 -1
- package/src/components/badge/Badge.tsx +7 -13
- package/src/components/button/Button.tsx +10 -18
- package/src/components/chip/Chip.tsx +7 -11
- package/src/components/icon/Icon.tsx +43 -6
- package/src/components/index.ts +1 -1
- package/src/components/menu/MenuItem.tsx +4 -9
- package/src/components/menu/types.ts +6 -6
- package/src/components/panel/Panel.tsx +7 -13
- package/src/components/tabpanel/Tab.tsx +6 -17
- package/src/core/aside/Aside.tsx +7 -13
- package/src/core/headfoot/HeadFoot.tsx +2 -2
- package/src/core/page/Page.tsx +8 -23
- package/src/overlays/alert/Alert.tsx +24 -5
- package/src/overlays/flyout/Flyout.tsx +5 -21
- package/src/overlays/message/Message.tsx +18 -3
- package/src/overlays/modal/Modal.tsx +5 -21
- package/src/overlays/toast/Toast.tsx +23 -4
- package/src/types/global.d.ts +8 -0
- package/src/types/icons.ts +3 -1
- package/src/types/index.ts +0 -19
|
@@ -32,14 +32,9 @@ import {
|
|
|
32
32
|
} from "@floating-ui/react";
|
|
33
33
|
import { isString } from "@react-fabric/utilities";
|
|
34
34
|
import classNames from "classnames";
|
|
35
|
-
import {
|
|
36
|
-
isValidElement,
|
|
37
|
-
useCallback,
|
|
38
|
-
useEffect,
|
|
39
|
-
type ElementType,
|
|
40
|
-
} from "react";
|
|
35
|
+
import { isValidElement, useCallback, useEffect } from "react";
|
|
41
36
|
import { Loading } from "../../components/animations/Animations";
|
|
42
|
-
import { Icon } from "../../components/icon/Icon";
|
|
37
|
+
import { getIconProps, Icon, IconProps } from "../../components/icon/Icon";
|
|
43
38
|
import { Header } from "../../core/headfoot/HeadFoot";
|
|
44
39
|
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
45
40
|
import {
|
|
@@ -47,17 +42,12 @@ import {
|
|
|
47
42
|
type CallbackReturn,
|
|
48
43
|
type ChildrenProp,
|
|
49
44
|
type Elements,
|
|
50
|
-
type IconProps,
|
|
51
45
|
type TestProps,
|
|
52
46
|
} from "../../types";
|
|
53
47
|
import { CoreIcons } from "../../types/icons";
|
|
54
48
|
|
|
55
|
-
export interface FlyoutProps
|
|
56
|
-
|
|
57
|
-
TestProps,
|
|
58
|
-
Omit<IconProps, "icon">,
|
|
59
|
-
ChildrenProp {
|
|
60
|
-
icon?: string | ElementType<IconProps>;
|
|
49
|
+
export interface FlyoutProps extends AriaProps, TestProps, ChildrenProp {
|
|
50
|
+
icon?: IconProps;
|
|
61
51
|
/**
|
|
62
52
|
* flyout alignment
|
|
63
53
|
*/
|
|
@@ -118,10 +108,7 @@ export interface FlyoutProps
|
|
|
118
108
|
|
|
119
109
|
export const Flyout = ({
|
|
120
110
|
icon,
|
|
121
|
-
iconBg,
|
|
122
|
-
iconColor,
|
|
123
111
|
iconClassName,
|
|
124
|
-
rtlFlip,
|
|
125
112
|
title,
|
|
126
113
|
actions,
|
|
127
114
|
closeOnClick,
|
|
@@ -236,11 +223,8 @@ export const Flyout = ({
|
|
|
236
223
|
>
|
|
237
224
|
{isString(icon) && (
|
|
238
225
|
<Icon
|
|
239
|
-
icon={icon}
|
|
240
|
-
bg={iconBg}
|
|
241
|
-
color={iconColor}
|
|
242
226
|
className={classNames(iconClassName, "p-1")}
|
|
243
|
-
|
|
227
|
+
{...getIconProps(icon)}
|
|
244
228
|
/>
|
|
245
229
|
)}
|
|
246
230
|
{isValidElement(icon) && icon}
|
|
@@ -24,10 +24,22 @@
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
26
26
|
import { Icon } from "../../components/icon/Icon";
|
|
27
|
-
import { type ColorState, type Elements
|
|
27
|
+
import { type ColorState, type Elements } from "../../types";
|
|
28
28
|
import { getColor } from "../../utils";
|
|
29
29
|
|
|
30
|
-
export interface MessageProps
|
|
30
|
+
export interface MessageProps {
|
|
31
|
+
/**
|
|
32
|
+
* svg path / webfont className / 1-4 letter text
|
|
33
|
+
*/
|
|
34
|
+
icon: string;
|
|
35
|
+
/**
|
|
36
|
+
* icon image source URL, if failed to load then shows icon
|
|
37
|
+
*/
|
|
38
|
+
iconSrc?: string;
|
|
39
|
+
/**
|
|
40
|
+
* flip icon in rtl
|
|
41
|
+
*/
|
|
42
|
+
rtlFlip?: boolean;
|
|
31
43
|
/**
|
|
32
44
|
* message title
|
|
33
45
|
*/
|
|
@@ -51,6 +63,7 @@ export const Message = ({
|
|
|
51
63
|
message,
|
|
52
64
|
color,
|
|
53
65
|
icon,
|
|
66
|
+
iconSrc,
|
|
54
67
|
rtlFlip,
|
|
55
68
|
actions,
|
|
56
69
|
// @ts-expect-error internal prop
|
|
@@ -87,7 +100,9 @@ export const Message = ({
|
|
|
87
100
|
}}
|
|
88
101
|
ref={elRef}
|
|
89
102
|
>
|
|
90
|
-
{icon &&
|
|
103
|
+
{icon && (
|
|
104
|
+
<Icon icon={icon} iconSrc={iconSrc} size="md" rtlFlip={rtlFlip} />
|
|
105
|
+
)}
|
|
91
106
|
{title && <div className="font-medium">{title}</div>}
|
|
92
107
|
<div className="truncate flex-initial">{message}</div>
|
|
93
108
|
{actions && (
|
|
@@ -32,14 +32,9 @@ import {
|
|
|
32
32
|
} from "@floating-ui/react";
|
|
33
33
|
import { isString } from "@react-fabric/utilities";
|
|
34
34
|
import classNames from "classnames";
|
|
35
|
-
import {
|
|
36
|
-
type ElementType,
|
|
37
|
-
isValidElement,
|
|
38
|
-
useCallback,
|
|
39
|
-
useEffect,
|
|
40
|
-
} from "react";
|
|
35
|
+
import { isValidElement, useCallback, useEffect } from "react";
|
|
41
36
|
import { Loading } from "../../components/animations/Animations";
|
|
42
|
-
import { Icon } from "../../components/icon/Icon";
|
|
37
|
+
import { getIconProps, Icon, IconProps } from "../../components/icon/Icon";
|
|
43
38
|
import { Header } from "../../core/headfoot/HeadFoot";
|
|
44
39
|
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
45
40
|
import {
|
|
@@ -47,17 +42,12 @@ import {
|
|
|
47
42
|
type CallbackReturn,
|
|
48
43
|
type ChildrenProp,
|
|
49
44
|
type Elements,
|
|
50
|
-
type IconProps,
|
|
51
45
|
type TestProps,
|
|
52
46
|
} from "../../types";
|
|
53
47
|
import { CoreIcons } from "../../types/icons";
|
|
54
48
|
|
|
55
|
-
export interface ModalProps
|
|
56
|
-
|
|
57
|
-
TestProps,
|
|
58
|
-
Omit<IconProps, "icon">,
|
|
59
|
-
ChildrenProp {
|
|
60
|
-
icon?: string | ElementType<IconProps>;
|
|
49
|
+
export interface ModalProps extends AriaProps, TestProps, ChildrenProp {
|
|
50
|
+
icon?: IconProps;
|
|
61
51
|
/**
|
|
62
52
|
* header className
|
|
63
53
|
*/
|
|
@@ -118,10 +108,7 @@ export interface ModalProps
|
|
|
118
108
|
|
|
119
109
|
export const Modal = ({
|
|
120
110
|
icon,
|
|
121
|
-
iconBg,
|
|
122
|
-
iconColor,
|
|
123
111
|
iconClassName,
|
|
124
|
-
rtlFlip,
|
|
125
112
|
title,
|
|
126
113
|
actions,
|
|
127
114
|
headerClassName,
|
|
@@ -226,11 +213,8 @@ export const Modal = ({
|
|
|
226
213
|
>
|
|
227
214
|
{isString(icon) && (
|
|
228
215
|
<Icon
|
|
229
|
-
icon={icon}
|
|
230
|
-
bg={iconBg}
|
|
231
|
-
color={iconColor}
|
|
232
216
|
className={classNames(iconClassName, "p-1")}
|
|
233
|
-
|
|
217
|
+
{...getIconProps(icon)}
|
|
234
218
|
/>
|
|
235
219
|
)}
|
|
236
220
|
{isValidElement(icon) && icon}
|
|
@@ -27,15 +27,27 @@ import { useTranslation } from "react-i18next";
|
|
|
27
27
|
import { AnimationIndicator } from "../../components/animations/Animations";
|
|
28
28
|
import { Button } from "../../components/button/Button";
|
|
29
29
|
import { Icon } from "../../components/icon/Icon";
|
|
30
|
-
import { type ColorState, type Elements
|
|
30
|
+
import { type ColorState, type Elements } from "../../types";
|
|
31
31
|
import { CoreIcons } from "../../types/icons";
|
|
32
32
|
import { getColor } from "../../utils";
|
|
33
33
|
|
|
34
|
-
export interface ToastProps
|
|
34
|
+
export interface ToastProps {
|
|
35
35
|
/**
|
|
36
36
|
* toast type
|
|
37
37
|
*/
|
|
38
38
|
type?: "alert" | "confirm";
|
|
39
|
+
/**
|
|
40
|
+
* svg path / webfont className / 1-4 letter text
|
|
41
|
+
*/
|
|
42
|
+
icon: string;
|
|
43
|
+
/**
|
|
44
|
+
* icon image source URL, if failed to load then shows icon
|
|
45
|
+
*/
|
|
46
|
+
iconSrc?: string;
|
|
47
|
+
/**
|
|
48
|
+
* flip icon in rtl
|
|
49
|
+
*/
|
|
50
|
+
rtlFlip?: boolean;
|
|
39
51
|
/**
|
|
40
52
|
* toast title
|
|
41
53
|
*/
|
|
@@ -67,6 +79,7 @@ export const Toast = ({
|
|
|
67
79
|
message,
|
|
68
80
|
color = "primary",
|
|
69
81
|
icon,
|
|
82
|
+
iconSrc,
|
|
70
83
|
rtlFlip,
|
|
71
84
|
actions,
|
|
72
85
|
// @ts-expect-error internal prop
|
|
@@ -82,7 +95,13 @@ export const Toast = ({
|
|
|
82
95
|
const iconType = useMemo(() => {
|
|
83
96
|
if (icon)
|
|
84
97
|
return (
|
|
85
|
-
<Icon
|
|
98
|
+
<Icon
|
|
99
|
+
icon={icon}
|
|
100
|
+
iconSrc={iconSrc}
|
|
101
|
+
size="md"
|
|
102
|
+
rtlFlip={rtlFlip}
|
|
103
|
+
color={color + "-600"}
|
|
104
|
+
/>
|
|
86
105
|
);
|
|
87
106
|
switch (color) {
|
|
88
107
|
case "danger":
|
|
@@ -99,7 +118,7 @@ export const Toast = ({
|
|
|
99
118
|
/>
|
|
100
119
|
);
|
|
101
120
|
}
|
|
102
|
-
}, [color, type, icon]);
|
|
121
|
+
}, [color, type, icon, iconSrc, rtlFlip]);
|
|
103
122
|
|
|
104
123
|
const elRef = useRef<HTMLDivElement>(null);
|
|
105
124
|
const handleClose = useCallback(
|
package/src/types/global.d.ts
CHANGED
|
@@ -45,6 +45,14 @@ declare module "*.png" {
|
|
|
45
45
|
const content: any;
|
|
46
46
|
export default content;
|
|
47
47
|
}
|
|
48
|
+
declare module "*.jpg" {
|
|
49
|
+
const content: any;
|
|
50
|
+
export default content;
|
|
51
|
+
}
|
|
52
|
+
declare module "*.jpeg" {
|
|
53
|
+
const content: any;
|
|
54
|
+
export default content;
|
|
55
|
+
}
|
|
48
56
|
declare module "*.svg" {
|
|
49
57
|
const content: any;
|
|
50
58
|
export default content;
|
package/src/types/icons.ts
CHANGED
|
@@ -397,7 +397,7 @@ export namespace CoreIcons {
|
|
|
397
397
|
export const mediaOrient =
|
|
398
398
|
"M7.34,6.41L0.86,12.9L7.35,19.38L13.84,12.9L7.34,6.41M3.69,12.9L7.35,9.24L11,12.9L7.34,16.56L3.69,12.9M19.36,6.64C17.61,4.88 15.3,4 13,4V0.76L8.76,5L13,9.24V6C14.79,6 16.58,6.68 17.95,8.05C20.68,10.78 20.68,15.22 17.95,17.95C16.58,19.32 14.79,20 13,20C12.03,20 11.06,19.79 10.16,19.39L8.67,20.88C10,21.62 11.5,22 13,22C15.3,22 17.61,21.12 19.36,19.36C22.88,15.85 22.88,10.15 19.36,6.64Z";
|
|
399
399
|
export const mediaCrop =
|
|
400
|
-
"
|
|
400
|
+
"M13,17H17V13H19V17H23V19H19V23H17V19H13V17M11,17V19H9V17H11M7,17V19H5V17H7M19,9V11H17V9H19M19,5V7H17V5H19M15,5V7H13V5H15M11,5V7H9V5H11M7,5V7H5V5H7M7,13V15H5V13H7M7,9V11H5V9H7Z";
|
|
401
401
|
export const mediaImage =
|
|
402
402
|
"M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z";
|
|
403
403
|
export const mediaVideo =
|
|
@@ -437,6 +437,8 @@ export namespace CoreIcons {
|
|
|
437
437
|
"M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M6,7H18V9H6V7M6,11H15V13H6V11Z";
|
|
438
438
|
export const mediaCommentAdd =
|
|
439
439
|
"M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M11,6H13V9H16V11H13V14H11V11H8V9H11V6Z";
|
|
440
|
+
export const mediaCapture =
|
|
441
|
+
"M12,10L11.06,12.06L9,13L11.06,13.94L12,16L12.94,13.94L15,13L12.94,12.06L12,10M20,5H16.83L15,3H9L7.17,5H4A2,2 0 0,0 2,7V19A2,2 0 0,0 4,21H20A2,2 0 0,0 22,19V7A2,2 0 0,0 20,5M20,19H4V7H8.05L8.64,6.35L9.88,5H14.12L15.36,6.35L15.95,7H20V19M12,8A5,5 0 0,0 7,13A5,5 0 0,0 12,18A5,5 0 0,0 17,13A5,5 0 0,0 12,8M12,16A3,3 0 0,1 9,13A3,3 0 0,1 12,10A3,3 0 0,1 15,13A3,3 0 0,1 12,16Z";
|
|
440
442
|
|
|
441
443
|
export const mediaLightness =
|
|
442
444
|
"M12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z";
|
package/src/types/index.ts
CHANGED
|
@@ -390,25 +390,6 @@ export type PolymorphicProps<AsTag extends ReactTag> = Omit<
|
|
|
390
390
|
as?: AsTag;
|
|
391
391
|
};
|
|
392
392
|
|
|
393
|
-
export interface IconProps {
|
|
394
|
-
/**
|
|
395
|
-
* svg path / image url
|
|
396
|
-
*/
|
|
397
|
-
icon?: string;
|
|
398
|
-
/**
|
|
399
|
-
* flip icon in rtl
|
|
400
|
-
*/
|
|
401
|
-
rtlFlip?: boolean;
|
|
402
|
-
/**
|
|
403
|
-
* icon background color
|
|
404
|
-
*/
|
|
405
|
-
iconBg?: ColorType | PaletteType | string;
|
|
406
|
-
/**
|
|
407
|
-
* icon color
|
|
408
|
-
*/
|
|
409
|
-
iconColor?: ColorType | PaletteType | string;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
393
|
export interface CollapseProps {
|
|
413
394
|
/**
|
|
414
395
|
* Allow collapsing
|