@react-fabric/core 1.0.0-beta.60 → 1.0.0-beta.62
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/_breadcrumbs.css +2 -0
- package/css/components/_button.css +16 -2
- package/css/components/_icon.css +1 -1
- package/css/components/_modal.css +2 -2
- package/css/core/_theme.css +1 -1
- package/css/reset/_reset.css +5 -1
- package/css/reset/_theme.css +3 -3
- package/css/styles.css +2 -0
- package/css/theme/_colors.css +2 -2
- package/dist/cjs/components/animations/Animations.js +54 -49
- package/dist/cjs/components/button/Button.js +2 -2
- package/dist/cjs/components/callout/Callout.js +4 -4
- package/dist/cjs/components/collapsable/Collapsable.js +4 -5
- package/dist/cjs/components/dropdown/Dropdown.js +13 -1
- package/dist/cjs/components/dropdown/DropdownTool.js +1 -2
- package/dist/cjs/components/icon/Icon.js +24 -24
- package/dist/cjs/components/media/Media.js +9 -8
- package/dist/cjs/components/menu/Menu.js +5 -5
- package/dist/cjs/components/menu/MenuItem.js +1 -2
- package/dist/cjs/components/navigator/Navigator.js +4 -5
- package/dist/cjs/components/panel/Panel.js +7 -7
- package/dist/cjs/components/tabpanel/Tab.js +0 -1
- package/dist/cjs/components/tabpanel/TabPanel.js +3 -2
- package/dist/cjs/core/aside/Aside.js +3 -4
- package/dist/cjs/core/page/Page.js +1 -1
- package/dist/cjs/core/theme/ThemeProvider.js +3 -2
- package/dist/cjs/hooks/useNavigator.js +9 -8
- package/dist/cjs/hooks/useOverlayService.js +34 -13
- package/dist/cjs/hooks/useStepper.js +0 -1
- package/dist/cjs/i18n/index.js +4 -4
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/overlays/alert/Alert.js +1 -2
- package/dist/cjs/overlays/flyout/Flyout.js +2 -3
- package/dist/cjs/overlays/modal/Modal.js +2 -3
- package/dist/cjs/overlays/toast/Toast.js +2 -3
- package/dist/cjs/overlays/tooltip/Tooltip.js +1 -2
- package/dist/cjs/typography/Copy.js +1 -2
- package/dist/esm/components/animations/Animations.js +51 -47
- package/dist/esm/components/button/Button.js +2 -2
- package/dist/esm/components/callout/Callout.js +4 -4
- package/dist/esm/components/collapsable/Collapsable.js +4 -5
- package/dist/esm/components/dropdown/Dropdown.js +14 -2
- package/dist/esm/components/dropdown/DropdownTool.js +1 -2
- package/dist/esm/components/icon/Icon.js +24 -24
- package/dist/esm/components/media/Media.js +9 -8
- package/dist/esm/components/menu/Menu.js +5 -5
- package/dist/esm/components/menu/MenuItem.js +1 -2
- package/dist/esm/components/navigator/Navigator.js +4 -5
- package/dist/esm/components/panel/Panel.js +8 -8
- package/dist/esm/components/tabpanel/Tab.js +0 -1
- package/dist/esm/components/tabpanel/TabPanel.js +3 -2
- package/dist/esm/core/aside/Aside.js +4 -5
- package/dist/esm/core/page/Page.js +2 -2
- package/dist/esm/core/theme/ThemeProvider.js +3 -2
- package/dist/esm/hooks/useNavigator.js +10 -9
- package/dist/esm/hooks/useOverlayService.js +35 -14
- package/dist/esm/hooks/useStepper.js +0 -1
- package/dist/esm/i18n/index.js +2 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/overlays/alert/Alert.js +1 -2
- package/dist/esm/overlays/flyout/Flyout.js +3 -4
- package/dist/esm/overlays/modal/Modal.js +3 -4
- package/dist/esm/overlays/toast/Toast.js +2 -3
- package/dist/esm/overlays/tooltip/Tooltip.js +1 -2
- package/dist/esm/typography/Copy.js +1 -2
- package/dist/types/components/animations/Animations.d.ts +28 -9
- package/dist/types/components/collapsable/Collapsable.d.ts +2 -2
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/menu/types.d.ts +6 -1
- package/dist/types/components/navigator/Navigator.d.ts +6 -0
- package/dist/types/components/panel/Panel.d.ts +1 -1
- package/dist/types/core/aside/Aside.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +2 -2
- package/dist/types/hooks/useOverlayService.d.ts +3 -5
- package/dist/types/index.d.ts +0 -1
- package/dist/types/types/index.d.ts +9 -3
- package/package.json +6 -3
- package/src/components/animations/Animations.tsx +53 -45
- package/src/components/button/Button.tsx +4 -2
- package/src/components/callout/Callout.tsx +4 -5
- package/src/components/collapsable/Collapsable.tsx +4 -5
- package/src/components/dropdown/Dropdown.tsx +23 -6
- package/src/components/dropdown/DropdownTool.tsx +1 -2
- package/src/components/icon/Icon.tsx +22 -22
- package/src/components/index.ts +5 -4
- package/src/components/media/Media.tsx +7 -8
- package/src/components/menu/Menu.tsx +4 -4
- package/src/components/menu/MenuItem.tsx +1 -1
- package/src/components/menu/types.ts +6 -1
- package/src/components/navigator/Navigator.tsx +11 -5
- package/src/components/panel/Panel.tsx +14 -8
- package/src/components/tabpanel/TabPanel.tsx +2 -1
- package/src/core/aside/Aside.tsx +4 -5
- package/src/core/page/Page.tsx +2 -2
- package/src/core/theme/ThemeProvider.tsx +4 -2
- package/src/hooks/useNavigator.tsx +10 -11
- package/src/hooks/useOverlayService.tsx +29 -16
- package/src/i18n/index.ts +2 -2
- package/src/index.ts +0 -1
- package/src/overlays/alert/Alert.tsx +1 -2
- package/src/overlays/flyout/Flyout.tsx +3 -4
- package/src/overlays/modal/Modal.tsx +3 -4
- package/src/overlays/toast/Toast.tsx +2 -3
- package/src/overlays/tooltip/Tooltip.tsx +1 -2
- package/src/types/index.ts +32 -2
- package/src/typography/Copy.tsx +1 -2
- package/css/flags.rect.css +0 -1607
- package/css/flags.wavy.css +0 -1606
- package/dist/cjs/types/icons.js +0 -212
- package/dist/esm/types/icons.js +0 -214
- package/dist/types/types/icons.d.ts +0 -210
- package/src/types/icons.ts +0 -451
- /package/dist/cjs/i18n/{ar.json.js → ar/core.json.js} +0 -0
- /package/dist/cjs/i18n/{en.json.js → en/core.json.js} +0 -0
- /package/dist/esm/i18n/{ar.json.js → ar/core.json.js} +0 -0
- /package/dist/esm/i18n/{en.json.js → en/core.json.js} +0 -0
- /package/src/i18n/{ar.json → ar/core.json} +0 -0
- /package/src/i18n/{en.json → en/core.json} +0 -0
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { isEmpty } from "@react-fabric/utilities";
|
|
24
25
|
import classNames from "classnames";
|
|
25
26
|
import { useCallback } from "react";
|
|
26
27
|
import { HotKey } from "../../hotkeys/HotKey";
|
|
@@ -32,17 +33,22 @@ import {
|
|
|
32
33
|
type PaletteType,
|
|
33
34
|
type TestProps,
|
|
34
35
|
} from "../../types";
|
|
35
|
-
import { CoreIcons } from "../../types/icons";
|
|
36
36
|
import { Icon } from "../icon/Icon";
|
|
37
|
-
import { isEmpty } from "@react-fabric/utilities";
|
|
38
37
|
|
|
39
38
|
export interface NavigatorProps
|
|
40
39
|
extends CssProp,
|
|
41
40
|
AriaProps,
|
|
42
41
|
TestProps,
|
|
43
42
|
Partial<ChildProp> {
|
|
43
|
+
/**
|
|
44
|
+
* item list length (ignore to enable infinite navigation)
|
|
45
|
+
*/
|
|
44
46
|
length?: number;
|
|
47
|
+
/**
|
|
48
|
+
* current item index (ignore to enable infinite navigation)
|
|
49
|
+
*/
|
|
45
50
|
current?: number;
|
|
51
|
+
|
|
46
52
|
disableKeyHandlers?: boolean;
|
|
47
53
|
/**
|
|
48
54
|
* navigator button color
|
|
@@ -88,7 +94,7 @@ export const Navigator = ({
|
|
|
88
94
|
}: NavigatorProps) => {
|
|
89
95
|
const navPrev = useCallback(
|
|
90
96
|
() => (isEmpty(current) || current !== 0) && onNavigate(-1),
|
|
91
|
-
[onNavigate, current],
|
|
97
|
+
[onNavigate, current, length],
|
|
92
98
|
);
|
|
93
99
|
const navNext = useCallback(
|
|
94
100
|
() => (isEmpty(current) || current + 1 < (length ?? 0)) && onNavigate(+1),
|
|
@@ -108,7 +114,7 @@ export const Navigator = ({
|
|
|
108
114
|
className="text-[1em] p-1"
|
|
109
115
|
aria-label="previous"
|
|
110
116
|
data-ref="previous"
|
|
111
|
-
icon=
|
|
117
|
+
icon="icon-[mdi--chevron-left]"
|
|
112
118
|
disabled={!isEmpty(current) && current === 0}
|
|
113
119
|
onClick={(e) => [e.stopPropagation(), navPrev()]}
|
|
114
120
|
/>
|
|
@@ -119,7 +125,7 @@ export const Navigator = ({
|
|
|
119
125
|
color={color}
|
|
120
126
|
aria-label="next"
|
|
121
127
|
data-ref="next"
|
|
122
|
-
icon=
|
|
128
|
+
icon="icon-[mdi--chevron-right]"
|
|
123
129
|
disabled={!isEmpty(current) && current + 1 === length}
|
|
124
130
|
onClick={(e) => [e.stopPropagation(), navNext()]}
|
|
125
131
|
/>
|
|
@@ -35,8 +35,7 @@ import {
|
|
|
35
35
|
type ExpandProps,
|
|
36
36
|
type TestProps,
|
|
37
37
|
} from "../../types";
|
|
38
|
-
import {
|
|
39
|
-
import { Loading } from "../animations/Animations";
|
|
38
|
+
import { LoadingLine } from "../animations/Animations";
|
|
40
39
|
import { getIconProps, Icon, type IconProps } from "../icon/Icon";
|
|
41
40
|
|
|
42
41
|
export interface PanelProps
|
|
@@ -119,7 +118,7 @@ export interface PanelProps
|
|
|
119
118
|
* ```jsx
|
|
120
119
|
* <Panel
|
|
121
120
|
* title="Panel Title"
|
|
122
|
-
* icon=
|
|
121
|
+
* icon="icon-[mdi--info]"
|
|
123
122
|
* actions={<button>Action</button>}
|
|
124
123
|
* expandable
|
|
125
124
|
* collapsable
|
|
@@ -216,9 +215,10 @@ export const Panel = ({
|
|
|
216
215
|
>
|
|
217
216
|
{onBack && (
|
|
218
217
|
<Icon
|
|
218
|
+
rtlFlip
|
|
219
219
|
data-ref="panelBack"
|
|
220
220
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
221
|
-
icon=
|
|
221
|
+
icon="icon-[mdi--chevron-left]"
|
|
222
222
|
onClick={onBack}
|
|
223
223
|
/>
|
|
224
224
|
)}
|
|
@@ -248,7 +248,11 @@ export const Panel = ({
|
|
|
248
248
|
<Icon
|
|
249
249
|
data-ref="panelExpand"
|
|
250
250
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
251
|
-
icon={
|
|
251
|
+
icon={
|
|
252
|
+
expanded
|
|
253
|
+
? "icon-[mdi--fullscreen-exit]"
|
|
254
|
+
: "icon-[mdi--fullscreen]"
|
|
255
|
+
}
|
|
252
256
|
onClick={toggleExpand}
|
|
253
257
|
/>
|
|
254
258
|
)}
|
|
@@ -256,7 +260,9 @@ export const Panel = ({
|
|
|
256
260
|
<Icon
|
|
257
261
|
data-ref="panelCollapse"
|
|
258
262
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
259
|
-
icon={
|
|
263
|
+
icon={
|
|
264
|
+
collapsed ? "icon-[mdi--plus-box]" : "icon-[mdi--minus-box]"
|
|
265
|
+
}
|
|
260
266
|
onClick={toggleCollapse}
|
|
261
267
|
/>
|
|
262
268
|
)}
|
|
@@ -264,7 +270,7 @@ export const Panel = ({
|
|
|
264
270
|
<Icon
|
|
265
271
|
data-ref="panelClose"
|
|
266
272
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
267
|
-
icon=
|
|
273
|
+
icon="icon-[mdi--close]"
|
|
268
274
|
onClick={onClose}
|
|
269
275
|
/>
|
|
270
276
|
)}
|
|
@@ -279,7 +285,7 @@ export const Panel = ({
|
|
|
279
285
|
"area-content grid overflow-hidden",
|
|
280
286
|
)}
|
|
281
287
|
>
|
|
282
|
-
{loading && <
|
|
288
|
+
{loading && <LoadingLine />}
|
|
283
289
|
{children}
|
|
284
290
|
</div>
|
|
285
291
|
)}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { getValue } from "@react-fabric/utilities";
|
|
24
25
|
import classNames from "classnames";
|
|
25
26
|
import {
|
|
26
27
|
Children,
|
|
@@ -153,7 +154,7 @@ export const TabPanel = ({
|
|
|
153
154
|
}, [children]);
|
|
154
155
|
|
|
155
156
|
useEffect(() => {
|
|
156
|
-
setActive(activeTab);
|
|
157
|
+
setActive(getValue(activeTab ?? tabs[0]?.props.id));
|
|
157
158
|
}, [activeTab]);
|
|
158
159
|
|
|
159
160
|
const activeTabPanel = useMemo(() => {
|
package/src/core/aside/Aside.tsx
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
-
import {
|
|
26
|
+
import { LoadingLine } from "../../components/animations/Animations";
|
|
27
27
|
import { getIconProps, Icon, type IconProps } from "../../components/icon/Icon";
|
|
28
28
|
import { useLayoutEffectDebugger } from "../../hooks/useEffectDebugger";
|
|
29
29
|
import { usePropToggle } from "../../hooks/usePropToggle";
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
type Elements,
|
|
36
36
|
type TestProps,
|
|
37
37
|
} from "../../types";
|
|
38
|
-
import { CoreIcons } from "../../types/icons";
|
|
39
38
|
import { ErrorBoundary } from "../boundary/ErrorBoundary";
|
|
40
39
|
|
|
41
40
|
export interface AsideProps
|
|
@@ -111,7 +110,7 @@ export interface AsideProps
|
|
|
111
110
|
* ```jsx
|
|
112
111
|
* <Aside
|
|
113
112
|
* title="Sidebar Title"
|
|
114
|
-
* icon=
|
|
113
|
+
* icon=icon-[mdi--menu]
|
|
115
114
|
* rtlFlip={true}
|
|
116
115
|
* className="custom-aside"
|
|
117
116
|
* bodyClassName="custom-aside-body"
|
|
@@ -254,7 +253,7 @@ export const Aside = ({
|
|
|
254
253
|
<Icon
|
|
255
254
|
aria-label={isCollapsed ? "expand" : "collapse"}
|
|
256
255
|
className={classNames("fabric-asideCollapse", "p-2 select-none")}
|
|
257
|
-
icon=
|
|
256
|
+
icon="icon-[mdi--chevron-left]"
|
|
258
257
|
rtlFlip
|
|
259
258
|
onClick={toggleCollapse}
|
|
260
259
|
data-ref="asideToggle"
|
|
@@ -271,7 +270,7 @@ export const Aside = ({
|
|
|
271
270
|
)}
|
|
272
271
|
{actions && <div className={"fabric-asideActions"}>{actions}</div>}
|
|
273
272
|
</header>
|
|
274
|
-
{loading && <
|
|
273
|
+
{loading && <LoadingLine />}
|
|
275
274
|
{isCollapsed && (
|
|
276
275
|
<div
|
|
277
276
|
role="none"
|
package/src/core/page/Page.tsx
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import {
|
|
25
|
+
import { LoadingLine } from "../../components/animations/Animations";
|
|
26
26
|
import { getIconProps, Icon, type IconProps } from "../../components/icon/Icon";
|
|
27
27
|
import { type ChildrenProp, type RefProp, type TestProps } from "../../types";
|
|
28
28
|
|
|
@@ -116,7 +116,7 @@ export const Page = ({
|
|
|
116
116
|
{title}
|
|
117
117
|
</div>
|
|
118
118
|
)}
|
|
119
|
-
{loading && <
|
|
119
|
+
{loading && <LoadingLine />}
|
|
120
120
|
{children}
|
|
121
121
|
</div>
|
|
122
122
|
);
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
import { isColor } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useMemo } from "react";
|
|
27
|
-
import { type ChildrenProp } from "../../types";
|
|
28
27
|
import { useApplicationContext } from "../../context/Global";
|
|
28
|
+
import { type ChildrenProp, type CssProp } from "../../types";
|
|
29
29
|
|
|
30
30
|
export interface ThemeProps {
|
|
31
31
|
/**
|
|
@@ -91,7 +91,8 @@ export const ThemeProvider = ({
|
|
|
91
91
|
tintColor,
|
|
92
92
|
colorScheme,
|
|
93
93
|
rounding,
|
|
94
|
-
|
|
94
|
+
className,
|
|
95
|
+
}: ThemeProps & ChildrenProp & CssProp) => {
|
|
95
96
|
const { currentColorScheme } = useApplicationContext();
|
|
96
97
|
const styles = useMemo(() => {
|
|
97
98
|
const ret: KeyValue = {};
|
|
@@ -125,6 +126,7 @@ export const ThemeProvider = ({
|
|
|
125
126
|
"fabric-themeProvider",
|
|
126
127
|
"contents theme-base",
|
|
127
128
|
branding,
|
|
129
|
+
className,
|
|
128
130
|
)}
|
|
129
131
|
>
|
|
130
132
|
{children}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { useCallback, useMemo,
|
|
24
|
+
import { useCallback, useMemo, useState } from "react";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Custom hook to manage navigation through a list of items.
|
|
@@ -43,19 +43,18 @@ import { useCallback, useMemo, useRef, useState } from "react";
|
|
|
43
43
|
*/
|
|
44
44
|
export const useNavigator = (totalCount = 0, defaultIndex = 0) => {
|
|
45
45
|
const [currentIndex, setCurrentIndex] = useState(defaultIndex);
|
|
46
|
-
const refCurrent = useRef(defaultIndex);
|
|
47
46
|
|
|
48
47
|
const onNavigate = useCallback(
|
|
49
48
|
(dir: 1 | -1) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
setCurrentIndex((prevValue) => {
|
|
50
|
+
if (dir === -1) {
|
|
51
|
+
return prevValue > 0 ? prevValue - 1 : totalCount - 1;
|
|
52
|
+
}
|
|
53
|
+
if (dir === 1) {
|
|
54
|
+
return prevValue + 1 < totalCount ? prevValue + 1 : 0;
|
|
55
|
+
}
|
|
56
|
+
return prevValue;
|
|
57
|
+
});
|
|
59
58
|
},
|
|
60
59
|
[totalCount],
|
|
61
60
|
);
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { useRef, useState } from "react";
|
|
25
25
|
import { type ModalProps } from "../types";
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// return the blank function since state functionality will execute if the value is function
|
|
28
|
+
const EMPTY_FC = () => () => null;
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Hook to manage overlay components like modals or flyouts.
|
|
@@ -36,7 +37,8 @@ type OverlayComponent = ElementType<ModalProps<AnyObject>>;
|
|
|
36
37
|
* of the overlay when it is closed, allowing you to handle the result in a controlled manner.
|
|
37
38
|
*
|
|
38
39
|
* @param ModalOrFlyout - The component to be used as an overlay.
|
|
39
|
-
* @
|
|
40
|
+
* @param toggleOpen - If true, calling `openOverlay` while an overlay is already open will close the existing one instead of opening a new one.
|
|
41
|
+
* @returns An array containing the current overlay, a function to open it, and a boolean indicating if the overlay is open.
|
|
40
42
|
*
|
|
41
43
|
* @example
|
|
42
44
|
* ```jsx
|
|
@@ -50,27 +52,38 @@ type OverlayComponent = ElementType<ModalProps<AnyObject>>;
|
|
|
50
52
|
* <Overlay />
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
53
|
-
export const useOverlayService = (
|
|
54
|
-
ModalOrFlyout:
|
|
55
|
+
export const useOverlayService = <T extends AnyObject = AnyObject>(
|
|
56
|
+
ModalOrFlyout: React.FunctionComponent<ModalProps<T>>,
|
|
55
57
|
): [
|
|
56
|
-
Overlay: React.
|
|
57
|
-
openOverlay: (props?:
|
|
58
|
+
Overlay: React.FunctionComponent<Partial<T>>,
|
|
59
|
+
openOverlay: (props?: Partial<T>) => Promise<AnyObject>,
|
|
60
|
+
closeOverlay: ((args?: AnyObject) => void) | null,
|
|
58
61
|
] => {
|
|
59
|
-
const [Overlay, setOverlay] =
|
|
62
|
+
const [Overlay, setOverlay] =
|
|
63
|
+
useState<React.FunctionComponent<Partial<T>>>(EMPTY_FC);
|
|
60
64
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const existingOpenPromise = useRef<AnyObject | null>(null);
|
|
66
|
+
const openOverlay = async ({ onClose, ...outerProps }: AnyObject = {}) => {
|
|
67
|
+
if (existingOpenPromise.current) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
65
70
|
return await new Promise((resolve) => {
|
|
66
|
-
|
|
67
|
-
setOverlay(
|
|
71
|
+
existingOpenPromise.current = (args: AnyObject) => {
|
|
72
|
+
setOverlay(EMPTY_FC);
|
|
68
73
|
resolve(args);
|
|
69
74
|
onClose?.(args);
|
|
75
|
+
existingOpenPromise.current = null;
|
|
70
76
|
};
|
|
71
|
-
|
|
77
|
+
// eslint-disable-next-line react/display-name
|
|
78
|
+
setOverlay(() => (overrideProps: Partial<T>) => (
|
|
79
|
+
<ModalOrFlyout
|
|
80
|
+
{...outerProps}
|
|
81
|
+
{...(overrideProps as any)}
|
|
82
|
+
onClose={existingOpenPromise.current}
|
|
83
|
+
/>
|
|
84
|
+
));
|
|
72
85
|
});
|
|
73
86
|
};
|
|
74
87
|
|
|
75
|
-
return [Overlay, openOverlay];
|
|
88
|
+
return [Overlay, openOverlay, existingOpenPromise.current];
|
|
76
89
|
};
|
package/src/i18n/index.ts
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
/* istanbul ignore file */
|
|
24
24
|
|
|
25
25
|
import i18n from "i18next";
|
|
26
|
-
import ar from "./ar.json";
|
|
27
|
-
import en from "./en.json";
|
|
26
|
+
import ar from "./ar/core.json";
|
|
27
|
+
import en from "./en/core.json";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* add language bundles using bundle keys as namespaces
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,6 @@ import { AnimationIndicator } from "../../components/animations/Animations";
|
|
|
37
37
|
import { Button } from "../../components/button/Button";
|
|
38
38
|
import { Icon } from "../../components/icon/Icon";
|
|
39
39
|
import { type ColorState, type Elements } from "../../types";
|
|
40
|
-
import { CoreIcons } from "../../types/icons";
|
|
41
40
|
import { Title } from "../../typography/Title";
|
|
42
41
|
import { getColor } from "../../utils";
|
|
43
42
|
|
|
@@ -256,7 +255,7 @@ export const Alert = ({
|
|
|
256
255
|
className="m-0"
|
|
257
256
|
color={color}
|
|
258
257
|
onClick={() => handleClose(false)}
|
|
259
|
-
icon=
|
|
258
|
+
icon="icon-[mdi--close]"
|
|
260
259
|
aria-label="close"
|
|
261
260
|
/>
|
|
262
261
|
</div>
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import { isString } from "@react-fabric/utilities";
|
|
34
34
|
import classNames from "classnames";
|
|
35
35
|
import { isValidElement, useCallback, useEffect } from "react";
|
|
36
|
-
import {
|
|
36
|
+
import { LoadingLine } from "../../components/animations/Animations";
|
|
37
37
|
import { getIconProps, Icon, type IconProps } from "../../components/icon/Icon";
|
|
38
38
|
import { Header } from "../../core/headfoot/HeadFoot";
|
|
39
39
|
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
type Elements,
|
|
45
45
|
type TestProps,
|
|
46
46
|
} from "../../types";
|
|
47
|
-
import { CoreIcons } from "../../types/icons";
|
|
48
47
|
|
|
49
48
|
export interface FlyoutProps extends AriaProps, TestProps, ChildrenProp {
|
|
50
49
|
icon?: IconProps;
|
|
@@ -236,11 +235,11 @@ export const Flyout = ({
|
|
|
236
235
|
"fabric-panelAction",
|
|
237
236
|
"cursor-pointer p-1 text-xl self-center",
|
|
238
237
|
)}
|
|
239
|
-
icon=
|
|
238
|
+
icon="icon-[mdi--close]"
|
|
240
239
|
onClick={() => handleClose(false)}
|
|
241
240
|
/>
|
|
242
241
|
</Header>
|
|
243
|
-
{loading && <
|
|
242
|
+
{loading && <LoadingLine />}
|
|
244
243
|
<div
|
|
245
244
|
role="dialog"
|
|
246
245
|
className={classNames(
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import { isString } from "@react-fabric/utilities";
|
|
34
34
|
import classNames from "classnames";
|
|
35
35
|
import { isValidElement, useCallback, useEffect } from "react";
|
|
36
|
-
import {
|
|
36
|
+
import { LoadingLine } from "../../components/animations/Animations";
|
|
37
37
|
import { getIconProps, Icon, type IconProps } from "../../components/icon/Icon";
|
|
38
38
|
import { Header } from "../../core/headfoot/HeadFoot";
|
|
39
39
|
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
type Elements,
|
|
45
45
|
type TestProps,
|
|
46
46
|
} from "../../types";
|
|
47
|
-
import { CoreIcons } from "../../types/icons";
|
|
48
47
|
|
|
49
48
|
export interface ModalProps extends AriaProps, TestProps, ChildrenProp {
|
|
50
49
|
icon?: IconProps;
|
|
@@ -226,11 +225,11 @@ export const Modal = ({
|
|
|
226
225
|
"fabric-panelAction",
|
|
227
226
|
"cursor-pointer p-1 text-xl self-center",
|
|
228
227
|
)}
|
|
229
|
-
icon=
|
|
228
|
+
icon="icon-[mdi--close]"
|
|
230
229
|
onClick={() => handleClose(false)}
|
|
231
230
|
/>
|
|
232
231
|
</Header>
|
|
233
|
-
{loading && <
|
|
232
|
+
{loading && <LoadingLine />}
|
|
234
233
|
<div
|
|
235
234
|
role="dialog"
|
|
236
235
|
className={classNames(
|
|
@@ -28,7 +28,6 @@ import { AnimationIndicator } from "../../components/animations/Animations";
|
|
|
28
28
|
import { Button } from "../../components/button/Button";
|
|
29
29
|
import { Icon } from "../../components/icon/Icon";
|
|
30
30
|
import { type ColorState, type Elements } from "../../types";
|
|
31
|
-
import { CoreIcons } from "../../types/icons";
|
|
32
31
|
import { getColor } from "../../utils";
|
|
33
32
|
|
|
34
33
|
export interface ToastProps {
|
|
@@ -175,7 +174,7 @@ export const Toast = ({
|
|
|
175
174
|
variant="link"
|
|
176
175
|
className="m-0"
|
|
177
176
|
color={color}
|
|
178
|
-
icon=
|
|
177
|
+
icon="icon-[mdi--close-box-multiple-outline]"
|
|
179
178
|
aria-label="close-all"
|
|
180
179
|
onClick={onCloseAll}
|
|
181
180
|
/>
|
|
@@ -184,7 +183,7 @@ export const Toast = ({
|
|
|
184
183
|
variant="link"
|
|
185
184
|
className="m-0"
|
|
186
185
|
color={color}
|
|
187
|
-
icon=
|
|
186
|
+
icon="icon-[mdi--close]"
|
|
188
187
|
aria-label="close"
|
|
189
188
|
onClick={() => handleClose(false)}
|
|
190
189
|
/>
|
|
@@ -51,7 +51,6 @@ import {
|
|
|
51
51
|
import { Icon } from "../../components/icon/Icon";
|
|
52
52
|
import { useIsRtl } from "../../hooks/useIsRtl";
|
|
53
53
|
import { type RefProp, type TooltipType } from "../../types";
|
|
54
|
-
import { CoreIcons } from "../../types/icons";
|
|
55
54
|
import { getColor } from "../../utils";
|
|
56
55
|
|
|
57
56
|
export interface TooltipProps extends TooltipType, RefProp {
|
|
@@ -159,7 +158,7 @@ export const Tooltip = ({
|
|
|
159
158
|
className="ms-2 cursor-pointer text-dimmed flex-content opacity-75 hover:opacity-90 active:opacity-60"
|
|
160
159
|
onClick={handler}
|
|
161
160
|
>
|
|
162
|
-
<Icon icon=
|
|
161
|
+
<Icon icon="icon-[mdi--content-copy]" />
|
|
163
162
|
</span>
|
|
164
163
|
);
|
|
165
164
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -34,8 +34,10 @@ export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
|
34
34
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
35
35
|
|
|
36
36
|
export type ColorState =
|
|
37
|
+
| "default"
|
|
37
38
|
| "primary"
|
|
38
39
|
| "accent"
|
|
40
|
+
| "muted"
|
|
39
41
|
| "info"
|
|
40
42
|
| "danger"
|
|
41
43
|
| "success"
|
|
@@ -425,11 +427,22 @@ export interface TooltipProp {
|
|
|
425
427
|
tooltip?: string | TooltipType;
|
|
426
428
|
}
|
|
427
429
|
|
|
428
|
-
export
|
|
430
|
+
export type ReactElement =
|
|
431
|
+
| React.ReactElement
|
|
432
|
+
| string
|
|
433
|
+
| number
|
|
434
|
+
| bigint
|
|
435
|
+
| Iterable<React.ReactNode>
|
|
436
|
+
| React.ReactPortal
|
|
437
|
+
| boolean
|
|
438
|
+
| null
|
|
439
|
+
| undefined;
|
|
440
|
+
|
|
441
|
+
export interface ChildProp<T = ReactElement> {
|
|
429
442
|
children: Elements<T>;
|
|
430
443
|
}
|
|
431
444
|
|
|
432
|
-
export interface ChildrenProp<T =
|
|
445
|
+
export interface ChildrenProp<T = ReactElement> {
|
|
433
446
|
children: Elements<T> | Array<Elements<T>>;
|
|
434
447
|
}
|
|
435
448
|
|
|
@@ -460,3 +473,20 @@ export type Complete<T> = {
|
|
|
460
473
|
? T[P]
|
|
461
474
|
: T[P] | undefined;
|
|
462
475
|
};
|
|
476
|
+
|
|
477
|
+
export type NestedKeys<T> = T extends object
|
|
478
|
+
? {
|
|
479
|
+
[K in keyof T]: K extends string | number
|
|
480
|
+
? T[K] extends object
|
|
481
|
+
? // Check for array type explicitly and handle it
|
|
482
|
+
T[K] extends readonly any[]
|
|
483
|
+
? T[K][number] extends object
|
|
484
|
+
? // Array of objects/items: return key with array index notation and recurse
|
|
485
|
+
`${K}.${NestedKeys<T[K][number]>}` | `${K}`
|
|
486
|
+
: `${K}`
|
|
487
|
+
: // Standard object: return key with dot notation and recurse
|
|
488
|
+
`${K}.${NestedKeys<T[K]>}` | `${K}`
|
|
489
|
+
: `${K}`
|
|
490
|
+
: never;
|
|
491
|
+
}[keyof T]
|
|
492
|
+
: "";
|
package/src/typography/Copy.tsx
CHANGED
|
@@ -27,7 +27,6 @@ import { useTranslation } from "react-i18next";
|
|
|
27
27
|
import { Button } from "../components/button/Button";
|
|
28
28
|
import { Tooltip } from "../overlays/tooltip/Tooltip";
|
|
29
29
|
import { type CssProp, type SizeType } from "../types";
|
|
30
|
-
import { CoreIcons } from "../types/icons";
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* A component that provides a button to copy text to the clipboard.
|
|
@@ -63,7 +62,7 @@ export const Copy = ({ text, size, className }: CopyProps) => {
|
|
|
63
62
|
return (
|
|
64
63
|
<Tooltip content={t("action.copy")}>
|
|
65
64
|
<Button
|
|
66
|
-
icon=
|
|
65
|
+
icon="icon-[mdi--content-copy]"
|
|
67
66
|
aria-label="Copy text"
|
|
68
67
|
actionMessage={t("action.copied")}
|
|
69
68
|
variant="link"
|