@react95/core 8.0.0-alpha.9 → 8.0.0
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/README.md +18 -42
- package/cjs/Avatar/Avatar.cjs +2 -19
- package/cjs/Button/Button.cjs +1 -1
- package/cjs/Fieldset/Fieldset.cjs +1 -1
- package/cjs/Frame/Frame.cjs +1 -0
- package/cjs/Input/Input.cjs +1 -20
- package/cjs/List/List.cjs +3 -5
- package/cjs/List/ListDivider.cjs +1 -11
- package/cjs/Modal/Modal.cjs +17 -36
- package/cjs/Modal/ModalProvider.cjs +6 -21
- package/cjs/Range/Range.cjs +9 -28
- package/cjs/Tabs/Tabs.cjs +16 -19
- package/cjs/TextArea/TextArea.cjs +2 -19
- package/cjs/TitleBar/TitleBar.cjs +10 -8
- package/cjs/Tooltip/Tooltip.cjs +6 -23
- package/cjs/Tree/Node.cjs +10 -27
- package/cjs/Tree/Tree.css.ts.vanilla.css +1 -1
- package/cjs/Video/Video.cjs +28 -44
- package/cjs/Video/buttons/Fullscreen.cjs +2 -19
- package/cjs/Video/buttons/Pause.cjs +2 -19
- package/cjs/Video/buttons/Play.cjs +2 -19
- package/cjs/Video/buttons/Stop.cjs +2 -19
- package/esm/Alert/Alert.mjs +6 -6
- package/esm/Avatar/Avatar.mjs +2 -2
- package/esm/Button/Button.mjs +4 -4
- package/esm/Checkbox/Checkbox.mjs +3 -3
- package/esm/Dropdown/Dropdown.mjs +2 -2
- package/esm/Fieldset/Fieldset.mjs +2 -2
- package/esm/Frame/Frame.mjs +4 -3
- package/esm/Input/Input.mjs +2 -4
- package/esm/List/List.mjs +3 -5
- package/esm/List/ListDivider.mjs +2 -12
- package/esm/List/ListItem.mjs +3 -3
- package/esm/Modal/Modal.mjs +9 -11
- package/esm/Modal/ModalProvider.mjs +6 -4
- package/esm/ProgressBar/ProgressBar.mjs +4 -4
- package/esm/RadioButton/RadioButton.mjs +3 -3
- package/esm/Range/Range.mjs +11 -13
- package/esm/Tabs/Tab.mjs +2 -2
- package/esm/Tabs/Tabs.mjs +21 -24
- package/esm/TaskBar/Clock.mjs +3 -3
- package/esm/TaskBar/TaskBar.mjs +9 -9
- package/esm/TaskBar/WindowButton.mjs +3 -3
- package/esm/TextArea/TextArea.mjs +2 -2
- package/esm/TitleBar/TitleBar.mjs +16 -14
- package/esm/Tooltip/Tooltip.mjs +5 -5
- package/esm/Tree/Node.mjs +2 -2
- package/esm/Tree/Tree.css.ts.vanilla.css +1 -1
- package/esm/Tree/Tree.mjs +2 -2
- package/esm/Video/Video.mjs +14 -13
- package/esm/Video/buttons/Fullscreen.mjs +1 -1
- package/esm/Video/buttons/Pause.mjs +1 -1
- package/esm/Video/buttons/Play.mjs +1 -1
- package/esm/Video/buttons/Stop.mjs +1 -1
- package/package.json +3 -3
- package/types/Avatar/Avatar.d.ts +7 -4
- package/types/Button/Button.d.ts +5 -2
- package/types/Checkbox/Checkbox.d.ts +3 -2
- package/types/Dropdown/Dropdown.d.ts +2 -1
- package/types/Fieldset/Fieldset.d.ts +2 -1
- package/types/Frame/Frame.d.ts +7 -4
- package/types/Input/Input.d.ts +1 -1
- package/types/List/List.d.ts +1 -1
- package/types/List/ListItem.d.ts +3 -2
- package/types/Modal/Modal.d.ts +8 -8
- package/types/Modal/ModalContext.d.ts +2 -2
- package/types/Modal/ModalProvider.d.ts +2 -2
- package/types/ProgressBar/ProgressBar.d.ts +6 -3
- package/types/RadioButton/RadioButton.d.ts +2 -1
- package/types/Range/Range.d.ts +1 -1
- package/types/Tabs/Tab.d.ts +3 -2
- package/types/Tabs/Tabs.d.ts +3 -2
- package/types/TaskBar/TaskBar.d.ts +2 -1
- package/types/TaskBar/WindowButton.d.ts +2 -1
- package/types/TextArea/TextArea.d.ts +1 -1
- package/types/TitleBar/TitleBar.d.ts +5 -4
- package/types/Tooltip/Tooltip.d.ts +3 -2
- package/types/Tree/Node.d.ts +7 -6
- package/types/Tree/Tree.d.ts +2 -2
- package/types/Video/Video.d.ts +10 -9
- package/types/Video/buttons/Fullscreen.d.ts +3 -2
- package/types/Video/buttons/Pause.d.ts +3 -2
- package/types/Video/buttons/Play.d.ts +3 -2
- package/types/Video/buttons/Stop.d.ts +3 -2
package/esm/Modal/Modal.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef, useContext, useState, useEffect } from "react";
|
|
2
2
|
import Draggable from "react-draggable";
|
|
3
3
|
import { Button } from "../Button/Button.mjs";
|
|
4
4
|
import { TitleBar } from "../TitleBar/TitleBar.mjs";
|
|
@@ -30,11 +30,11 @@ const ModalRenderer = ({
|
|
|
30
30
|
updateWindow,
|
|
31
31
|
setActiveWindow,
|
|
32
32
|
activeWindow
|
|
33
|
-
} =
|
|
34
|
-
const [id, setId] =
|
|
35
|
-
const [menuOpened, setMenuOpened] =
|
|
36
|
-
const [isActive, setIsActive] =
|
|
37
|
-
|
|
33
|
+
} = useContext(ModalContext);
|
|
34
|
+
const [id, setId] = useState(null);
|
|
35
|
+
const [menuOpened, setMenuOpened] = useState("");
|
|
36
|
+
const [isActive, setIsActive] = useState(false);
|
|
37
|
+
useEffect(() => {
|
|
38
38
|
if (!id) {
|
|
39
39
|
const newId = addWindows({ icon, title, hasButton });
|
|
40
40
|
if (newId) {
|
|
@@ -45,14 +45,14 @@ const ModalRenderer = ({
|
|
|
45
45
|
updateWindow(id, { icon, title, hasButton });
|
|
46
46
|
}
|
|
47
47
|
}, [id, icon, title, hasButton]);
|
|
48
|
-
|
|
48
|
+
useEffect(() => {
|
|
49
49
|
return () => {
|
|
50
50
|
if (id) {
|
|
51
51
|
removeWindow(id);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}, [id]);
|
|
55
|
-
|
|
55
|
+
useEffect(() => setIsActive(id === activeWindow), [id, activeWindow]);
|
|
56
56
|
return /* @__PURE__ */ React.createElement(
|
|
57
57
|
Draggable,
|
|
58
58
|
{
|
|
@@ -113,9 +113,7 @@ const ModalRenderer = ({
|
|
|
113
113
|
)
|
|
114
114
|
);
|
|
115
115
|
};
|
|
116
|
-
const Modal =
|
|
117
|
-
ModalRenderer
|
|
118
|
-
);
|
|
116
|
+
const Modal = forwardRef(ModalRenderer);
|
|
119
117
|
Modal.displayName = "Modal";
|
|
120
118
|
Modal.defaultProps = {
|
|
121
119
|
icon: void 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
|
-
import
|
|
2
|
+
import React, { useReducer, useState } from "react";
|
|
3
3
|
import { ModalContext } from "./ModalContext.mjs";
|
|
4
4
|
const windowStackReducer = (state, action) => {
|
|
5
5
|
const newWindows = { ...state };
|
|
@@ -20,9 +20,11 @@ const windowStackReducer = (state, action) => {
|
|
|
20
20
|
return state;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
const ModalProvider = ({
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const ModalProvider = ({
|
|
24
|
+
children
|
|
25
|
+
}) => {
|
|
26
|
+
const [windows, dispatch] = useReducer(windowStackReducer, {});
|
|
27
|
+
const [activeWindow, setActiveWindow] = useState();
|
|
26
28
|
const addWindows = (window) => {
|
|
27
29
|
const id = nanoid();
|
|
28
30
|
dispatch({ type: "ADD_WINDOW", id, window });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import cn from "classnames";
|
|
3
3
|
import { Frame } from "../Frame/Frame.mjs";
|
|
4
4
|
import { wrapper, whiteBar, container, progress } from "./ProgressBar.css.mjs";
|
|
5
5
|
const ProgressBar = forwardRef(
|
|
6
|
-
({ width = "150px", percent = 0, ...rest }, ref) => /* @__PURE__ */
|
|
6
|
+
({ width = "150px", percent = 0, ...rest }, ref) => /* @__PURE__ */ React.createElement(
|
|
7
7
|
Frame,
|
|
8
8
|
{
|
|
9
9
|
...rest,
|
|
@@ -11,8 +11,8 @@ const ProgressBar = forwardRef(
|
|
|
11
11
|
className: cn(wrapper, rest.className),
|
|
12
12
|
ref
|
|
13
13
|
},
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ React.createElement(Frame, { className: whiteBar, width }, `${percent}%`),
|
|
15
|
+
/* @__PURE__ */ React.createElement(Frame, { className: container, width: `${percent}%` }, /* @__PURE__ */ React.createElement(Frame, { className: progress, width }, `${percent}%`))
|
|
16
16
|
)
|
|
17
17
|
);
|
|
18
18
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { label, field, icon, text } from "./RadioButton.css.mjs";
|
|
3
3
|
const RadioButton = forwardRef(
|
|
4
|
-
({ children, disabled, ...props }, ref) => /* @__PURE__ */
|
|
4
|
+
({ children, disabled, ...props }, ref) => /* @__PURE__ */ React.createElement("label", { className: label }, /* @__PURE__ */ React.createElement(
|
|
5
5
|
"input",
|
|
6
6
|
{
|
|
7
7
|
type: "radio",
|
|
@@ -10,7 +10,7 @@ const RadioButton = forwardRef(
|
|
|
10
10
|
ref,
|
|
11
11
|
...props
|
|
12
12
|
}
|
|
13
|
-
), /* @__PURE__ */
|
|
13
|
+
), /* @__PURE__ */ React.createElement("span", { className: icon }), /* @__PURE__ */ React.createElement("span", { className: text }, children))
|
|
14
14
|
);
|
|
15
15
|
export {
|
|
16
16
|
RadioButton
|
package/esm/Range/Range.mjs
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { Frame } from "../Frame/Frame.mjs";
|
|
3
3
|
import { range } from "./Range.css.mjs";
|
|
4
4
|
import cn from "classnames";
|
|
5
|
-
const Range = React.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
16
|
-
);
|
|
5
|
+
const Range = forwardRef((rest, ref) => /* @__PURE__ */ React.createElement(
|
|
6
|
+
Frame,
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(range, rest.className),
|
|
11
|
+
as: "input",
|
|
12
|
+
type: "range"
|
|
13
|
+
}
|
|
14
|
+
));
|
|
17
15
|
export {
|
|
18
16
|
Range
|
|
19
17
|
};
|
package/esm/Tabs/Tab.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { tab } from "./Tabs.css.mjs";
|
|
3
3
|
import { Frame } from "../Frame/Frame.mjs";
|
|
4
4
|
const Tab = forwardRef(
|
|
5
|
-
({ activeTab, title, ...rest }, ref) => /* @__PURE__ */
|
|
5
|
+
({ activeTab, title, ...rest }, ref) => /* @__PURE__ */ React.createElement(
|
|
6
6
|
Frame,
|
|
7
7
|
{
|
|
8
8
|
...rest,
|
package/esm/Tabs/Tabs.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef, Children, useState } from "react";
|
|
2
2
|
import cn from "classnames";
|
|
3
3
|
import { Tab } from "./Tab.mjs";
|
|
4
4
|
import { navbar, navContainer } from "./Tabs.css.mjs";
|
|
5
5
|
import { Frame } from "../Frame/Frame.mjs";
|
|
6
6
|
const Tabs = forwardRef(
|
|
7
7
|
({ children, defaultActiveTab, onChange, ...rest }, ref) => {
|
|
8
|
-
const [firstTab] =
|
|
9
|
-
const [activeTab, setActiveTab] =
|
|
8
|
+
const [firstTab] = Children.toArray(children);
|
|
9
|
+
const [activeTab, setActiveTab] = useState(
|
|
10
10
|
defaultActiveTab || firstTab.props.title
|
|
11
11
|
);
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
13
13
|
Frame,
|
|
14
14
|
{
|
|
15
15
|
...rest,
|
|
@@ -17,29 +17,26 @@ const Tabs = forwardRef(
|
|
|
17
17
|
as: "ol",
|
|
18
18
|
ref
|
|
19
19
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (onChange) {
|
|
33
|
-
onChange(title, e);
|
|
34
|
-
}
|
|
35
|
-
setActiveTab(title);
|
|
20
|
+
Children.map(children, (child) => {
|
|
21
|
+
const { title, disabled } = child.props;
|
|
22
|
+
return /* @__PURE__ */ React.createElement(
|
|
23
|
+
Tab,
|
|
24
|
+
{
|
|
25
|
+
key: title,
|
|
26
|
+
...child.props,
|
|
27
|
+
activeTab,
|
|
28
|
+
onClick: (e) => {
|
|
29
|
+
if (!disabled) {
|
|
30
|
+
if (onChange) {
|
|
31
|
+
onChange(title, e);
|
|
36
32
|
}
|
|
33
|
+
setActiveTab(title);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
), /* @__PURE__ */
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
})
|
|
39
|
+
), /* @__PURE__ */ React.createElement(Frame, { className: navContainer, width: rest.width || rest.w }, Children.map(
|
|
43
40
|
children,
|
|
44
41
|
(child) => child.props.title === activeTab && child.props.children
|
|
45
42
|
)));
|
package/esm/TaskBar/Clock.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { Frame } from "../Frame/Frame.mjs";
|
|
3
3
|
import { Tooltip } from "../Tooltip/Tooltip.mjs";
|
|
4
4
|
import { tooltip } from "./TaskBar.css.mjs";
|
|
@@ -16,7 +16,7 @@ const Clock = () => {
|
|
|
16
16
|
});
|
|
17
17
|
return () => clearInterval(interval);
|
|
18
18
|
}, []);
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ React.createElement(
|
|
20
20
|
Frame,
|
|
21
21
|
{
|
|
22
22
|
boxShadow: "$in",
|
|
@@ -26,7 +26,7 @@ const Clock = () => {
|
|
|
26
26
|
justifyContent: "center",
|
|
27
27
|
alignItems: "center"
|
|
28
28
|
},
|
|
29
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ React.createElement(Tooltip, { className: tooltip }, timer)
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
export {
|
package/esm/TaskBar/TaskBar.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef, useState, useContext } from "react";
|
|
2
2
|
import { ModalContext } from "../Modal/ModalContext.mjs";
|
|
3
3
|
import { Frame } from "../Frame/Frame.mjs";
|
|
4
4
|
import { Clock } from "./Clock.mjs";
|
|
@@ -10,7 +10,7 @@ const TaskBar = forwardRef(
|
|
|
10
10
|
const [showList, toggleShowList] = useState(false);
|
|
11
11
|
const [activeStart, toggleActiveStart] = useState(false);
|
|
12
12
|
const { windows, activeWindow, setActiveWindow } = useContext(ModalContext);
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ React.createElement(
|
|
14
14
|
Frame,
|
|
15
15
|
{
|
|
16
16
|
position: "fixed",
|
|
@@ -27,7 +27,7 @@ const TaskBar = forwardRef(
|
|
|
27
27
|
boxShadow: "$out",
|
|
28
28
|
ref
|
|
29
29
|
},
|
|
30
|
-
showList && /* @__PURE__ */
|
|
30
|
+
showList && /* @__PURE__ */ React.createElement(
|
|
31
31
|
Frame,
|
|
32
32
|
{
|
|
33
33
|
position: "absolute",
|
|
@@ -39,11 +39,11 @@ const TaskBar = forwardRef(
|
|
|
39
39
|
},
|
|
40
40
|
list
|
|
41
41
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ React.createElement(
|
|
43
43
|
WindowButton,
|
|
44
44
|
{
|
|
45
45
|
small: true,
|
|
46
|
-
icon: /* @__PURE__ */
|
|
46
|
+
icon: /* @__PURE__ */ React.createElement(Logo, { variant: "32x32_4" }),
|
|
47
47
|
active: activeStart,
|
|
48
48
|
onClick: () => {
|
|
49
49
|
toggleActiveStart(!activeStart);
|
|
@@ -52,8 +52,8 @@ const TaskBar = forwardRef(
|
|
|
52
52
|
},
|
|
53
53
|
"Start"
|
|
54
54
|
),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
([windowId, { icon, title, hasButton }]) => hasButton && /* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ React.createElement(Frame, { w: "100%", paddingLeft: "$0", ml: "$2", display: "flex" }, Object.entries(windows).map(
|
|
56
|
+
([windowId, { icon, title, hasButton }]) => hasButton && /* @__PURE__ */ React.createElement(
|
|
57
57
|
WindowButton,
|
|
58
58
|
{
|
|
59
59
|
key: windowId,
|
|
@@ -62,10 +62,10 @@ const TaskBar = forwardRef(
|
|
|
62
62
|
onClick: () => setActiveWindow(windowId),
|
|
63
63
|
small: false
|
|
64
64
|
},
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ React.createElement("div", { className: truncate }, title)
|
|
66
66
|
)
|
|
67
67
|
)),
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ React.createElement(Clock, null)
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { windowsButton, icon } from "./TaskBar.css.mjs";
|
|
3
3
|
const WindowButton = forwardRef(
|
|
4
|
-
({ children, small = false, icon: icon$1, active = false, ...props }, ref) => /* @__PURE__ */
|
|
4
|
+
({ children, small = false, icon: icon$1, active = false, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
5
5
|
"button",
|
|
6
6
|
{
|
|
7
7
|
className: windowsButton({ active, small }),
|
|
8
8
|
...props,
|
|
9
9
|
ref
|
|
10
10
|
},
|
|
11
|
-
/* @__PURE__ */
|
|
11
|
+
/* @__PURE__ */ React.createElement("div", { className: icon }, icon$1),
|
|
12
12
|
children
|
|
13
13
|
)
|
|
14
14
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { Frame } from "../Frame/Frame.mjs";
|
|
3
3
|
import { input } from "../Input/Input.css.mjs";
|
|
4
|
-
const TextArea =
|
|
4
|
+
const TextArea = forwardRef(
|
|
5
5
|
(rest, ref) => /* @__PURE__ */ React.createElement(Frame, { ...rest, ref, className: input, as: "textarea" })
|
|
6
6
|
);
|
|
7
7
|
export {
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { Frame } from "../Frame/Frame.mjs";
|
|
3
3
|
import { optionsBox, option, titleBarBackground, title } from "./TitleBar.css.mjs";
|
|
4
4
|
import { button } from "../Button/Button.css.mjs";
|
|
5
5
|
import cn from "classnames";
|
|
6
|
-
const OptionsBox =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const OptionsBox = forwardRef(
|
|
7
|
+
(rest, ref) => /* @__PURE__ */ React.createElement(
|
|
8
|
+
Frame,
|
|
9
|
+
{
|
|
10
|
+
...rest,
|
|
11
|
+
ref,
|
|
12
|
+
className: cn(optionsBox, rest.className)
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
const Option = forwardRef(
|
|
17
|
+
(rest, ref) => /* @__PURE__ */ React.createElement(
|
|
16
18
|
Frame,
|
|
17
19
|
{
|
|
18
20
|
...rest,
|
|
@@ -22,7 +24,7 @@ const Option = React__default.forwardRef(
|
|
|
22
24
|
}
|
|
23
25
|
)
|
|
24
26
|
);
|
|
25
|
-
const TitleBarRenderer = ({ children, title: title$1 = "UNKNOWN.EXE", icon, active = true, ...rest }, ref) => /* @__PURE__ */
|
|
27
|
+
const TitleBarRenderer = ({ children, title: title$1 = "UNKNOWN.EXE", icon, active = true, ...rest }, ref) => /* @__PURE__ */ React.createElement(
|
|
26
28
|
Frame,
|
|
27
29
|
{
|
|
28
30
|
...rest,
|
|
@@ -30,11 +32,11 @@ const TitleBarRenderer = ({ children, title: title$1 = "UNKNOWN.EXE", icon, acti
|
|
|
30
32
|
ref
|
|
31
33
|
},
|
|
32
34
|
icon && icon,
|
|
33
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ React.createElement("div", { className: title }, title$1),
|
|
34
36
|
children
|
|
35
37
|
);
|
|
36
38
|
const TitleBar = Object.assign(
|
|
37
|
-
|
|
39
|
+
forwardRef(TitleBarRenderer),
|
|
38
40
|
{
|
|
39
41
|
Option,
|
|
40
42
|
OptionsBox
|
package/esm/Tooltip/Tooltip.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { wrapper, tip } from "./Tooltip.css.mjs";
|
|
1
|
+
import React, { forwardRef, useState } from "react";
|
|
3
2
|
import cn from "classnames";
|
|
3
|
+
import { wrapper, tip } from "./Tooltip.css.mjs";
|
|
4
4
|
function formatDate(date) {
|
|
5
5
|
const monthNames = [
|
|
6
6
|
"January",
|
|
@@ -27,8 +27,8 @@ const TooltipRenderer = ({
|
|
|
27
27
|
delay = 1e3,
|
|
28
28
|
...rest
|
|
29
29
|
}, ref) => {
|
|
30
|
-
const [show, setShow] =
|
|
31
|
-
const [delayTimer, setDelayTimer] =
|
|
30
|
+
const [show, setShow] = useState(false);
|
|
31
|
+
const [delayTimer, setDelayTimer] = useState(0);
|
|
32
32
|
const handleEnter = () => {
|
|
33
33
|
const timer = window.setTimeout(() => {
|
|
34
34
|
setShow(true);
|
|
@@ -52,7 +52,7 @@ const TooltipRenderer = ({
|
|
|
52
52
|
children
|
|
53
53
|
);
|
|
54
54
|
};
|
|
55
|
-
const Tooltip =
|
|
55
|
+
const Tooltip = forwardRef(
|
|
56
56
|
TooltipRenderer
|
|
57
57
|
);
|
|
58
58
|
export {
|
package/esm/Tree/Node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { MediaCd, FileText, Bat, FileFont2, FilePen, FileSettings, FileTextSettings, BatExec, FolderOpen, Folder } from "@react95/icons";
|
|
3
3
|
import { node, nodeContent, folderStatus, iconContainer, label, tree, nodeRoot } from "./Tree.css.mjs";
|
|
4
4
|
import { Frame } from "../Frame/Frame.mjs";
|
|
@@ -40,7 +40,7 @@ const Node = ({
|
|
|
40
40
|
},
|
|
41
41
|
...rest
|
|
42
42
|
}) => {
|
|
43
|
-
const [isOpen, setIsOpen] =
|
|
43
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
44
44
|
const hasChildren = children.length > 0;
|
|
45
45
|
const onClickHandler = (event) => {
|
|
46
46
|
onClick(event, {
|
package/esm/Tree/Tree.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { NodeRoot, Node, icons } from "./Node.mjs";
|
|
3
3
|
import { tree } from "./Tree.css.mjs";
|
|
4
4
|
import { Frame } from "../Frame/Frame.mjs";
|
|
5
5
|
const Tree = forwardRef(
|
|
6
6
|
({ data, root, ...rest }, ref) => {
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, root && /* @__PURE__ */ React.createElement(NodeRoot, { ...root }), /* @__PURE__ */ React.createElement(Frame, { ...rest, className: tree, as: "ul", ref }, data.map((dataNode) => /* @__PURE__ */ React.createElement(Node, { key: dataNode.id, ...dataNode }))));
|
|
8
8
|
}
|
|
9
9
|
);
|
|
10
10
|
Tree.defaultProps = {
|
package/esm/Video/Video.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef, useState, useRef, useImperativeHandle, useEffect } from "react";
|
|
2
2
|
import { Mplayer113, User4 } from "@react95/icons";
|
|
3
3
|
import { videoTag, divider, countDownContainer, videoFont, currentTime, elapsedTime, controls, controlBtn, range } from "./Video.css.mjs";
|
|
4
4
|
import { Frame } from "../Frame/Frame.mjs";
|
|
@@ -28,20 +28,20 @@ function parseCurrentTime(secs) {
|
|
|
28
28
|
return [hours, minutes, seconds].map((v) => v < 10 ? `0${v}` : v).filter((v, i) => v !== "00" || i > 0).join(":");
|
|
29
29
|
}
|
|
30
30
|
const VideoRenderer = ({ name, src, videoProps, ...props }, ref) => {
|
|
31
|
-
const [playing, setPlaying] =
|
|
32
|
-
const [loadeddata, setLoadeddata] =
|
|
33
|
-
const [progress, setProgress] =
|
|
34
|
-
const player =
|
|
35
|
-
const progressRef =
|
|
36
|
-
const wrapperRef =
|
|
37
|
-
const playPauseRef =
|
|
38
|
-
const stopRef =
|
|
39
|
-
const fullScreenRef =
|
|
31
|
+
const [playing, setPlaying] = useState(false);
|
|
32
|
+
const [loadeddata, setLoadeddata] = useState(false);
|
|
33
|
+
const [progress, setProgress] = useState(0);
|
|
34
|
+
const player = useRef(null);
|
|
35
|
+
const progressRef = useRef(null);
|
|
36
|
+
const wrapperRef = useRef(null);
|
|
37
|
+
const playPauseRef = useRef(null);
|
|
38
|
+
const stopRef = useRef(null);
|
|
39
|
+
const fullScreenRef = useRef(null);
|
|
40
40
|
const paths = arrayFy(src);
|
|
41
41
|
const [pathname] = paths;
|
|
42
42
|
const normalizedName = name || pathname.replace(/^.*[\\/]/, "");
|
|
43
43
|
const title = `${normalizedName}${!loadeddata ? " (Opening)" : ""}`;
|
|
44
|
-
|
|
44
|
+
useImperativeHandle(ref, () => ({
|
|
45
45
|
get video() {
|
|
46
46
|
return player;
|
|
47
47
|
},
|
|
@@ -61,7 +61,7 @@ const VideoRenderer = ({ name, src, videoProps, ...props }, ref) => {
|
|
|
61
61
|
return fullScreenRef;
|
|
62
62
|
}
|
|
63
63
|
}));
|
|
64
|
-
|
|
64
|
+
useEffect(() => {
|
|
65
65
|
var _a, _b, _c, _d;
|
|
66
66
|
(_a = player.current) == null ? void 0 : _a.addEventListener(
|
|
67
67
|
"ended",
|
|
@@ -127,6 +127,7 @@ const VideoRenderer = ({ name, src, videoProps, ...props }, ref) => {
|
|
|
127
127
|
), /* @__PURE__ */ React.createElement("div", { className: videoFont, style: { height: 12 } }, !loadeddata && "Openning")), /* @__PURE__ */ React.createElement(Frame, { display: "flex", flexDirection: "column", w: "40%" }, /* @__PURE__ */ React.createElement("div", { className: cn(videoFont, currentTime) }, player.current && parseCurrentTime(player.current.currentTime)), /* @__PURE__ */ React.createElement("div", { className: cn(videoFont, elapsedTime) }, "time"))), /* @__PURE__ */ React.createElement("div", { className: controls }, /* @__PURE__ */ React.createElement(
|
|
128
128
|
Button,
|
|
129
129
|
{
|
|
130
|
+
as: "button",
|
|
130
131
|
className: controlBtn,
|
|
131
132
|
disabled: !loadeddata,
|
|
132
133
|
onClick: () => {
|
|
@@ -200,7 +201,7 @@ const VideoRenderer = ({ name, src, videoProps, ...props }, ref) => {
|
|
|
200
201
|
)))
|
|
201
202
|
);
|
|
202
203
|
};
|
|
203
|
-
const Video =
|
|
204
|
+
const Video = forwardRef(VideoRenderer);
|
|
204
205
|
export {
|
|
205
206
|
Video
|
|
206
207
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react95/core",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Windows 95 styleguide",
|
|
5
5
|
"main": "cjs/index.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"nostalgic",
|
|
56
56
|
"design-system"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c0027899739b008d4ccaada7d0625fdc98242bdf",
|
|
59
59
|
"module": "esm/index.mjs",
|
|
60
60
|
"private": false,
|
|
61
|
-
"types": "
|
|
61
|
+
"types": "types/index.d.ts"
|
|
62
62
|
}
|
package/types/Avatar/Avatar.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ElementType, ReactElement, ElementRef, ForwardedRef, ImgHTMLAttributes } from 'react';
|
|
2
3
|
import { FrameProps } from '../Frame/Frame';
|
|
3
|
-
export
|
|
4
|
+
export type AvatarProps<TAs extends ElementType> = Omit<ImgHTMLAttributes<HTMLDivElement>, 'width' | 'color' | 'height'> & FrameProps<TAs> & {
|
|
4
5
|
circle?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const Avatar: React.
|
|
6
|
+
};
|
|
7
|
+
export declare const Avatar: <TAs extends React.ElementType = "div">(props: AvatarProps<TAs> & {
|
|
8
|
+
ref?: ForwardedRef<ElementRef<TAs>>;
|
|
9
|
+
}) => ReactElement;
|
package/types/Button/Button.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ElementType, ReactElement, ElementRef, ForwardedRef, ButtonHTMLAttributes } from 'react';
|
|
2
3
|
import { FrameProps } from '../Frame/Frame';
|
|
3
|
-
export type ButtonProps =
|
|
4
|
-
export declare const Button: React.
|
|
4
|
+
export type ButtonProps<TAs extends ElementType> = ButtonHTMLAttributes<HTMLButtonElement> & FrameProps<TAs>;
|
|
5
|
+
export declare const Button: <TAs extends React.ElementType = "button">(props: ButtonProps<TAs> & {
|
|
6
|
+
ref?: ForwardedRef<ElementRef<TAs>>;
|
|
7
|
+
}) => ReactElement;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { CSSProperties, HTMLProps } from 'react';
|
|
2
3
|
export type LabelProps = {
|
|
3
4
|
disabled?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export type CheckboxProps = {
|
|
6
7
|
label?: string;
|
|
7
8
|
children?: string;
|
|
8
|
-
style?:
|
|
9
|
-
} & LabelProps &
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
} & LabelProps & HTMLProps<HTMLInputElement>;
|
|
10
11
|
export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { HTMLProps } from 'react';
|
|
2
3
|
import { FrameProps } from '../Frame/Frame';
|
|
3
4
|
export type DropdownProps = {
|
|
4
5
|
options?: Array<string | number>;
|
|
5
|
-
} &
|
|
6
|
+
} & HTMLProps<HTMLSelectElement> & Omit<FrameProps<'select'>, 'as'>;
|
|
6
7
|
export declare const Dropdown: React.ForwardRefExoticComponent<Omit<DropdownProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { HTMLProps } from 'react';
|
|
2
3
|
import { FrameProps } from '../Frame/Frame';
|
|
3
4
|
export type FieldSetProps = {
|
|
4
5
|
legend?: string;
|
|
5
|
-
} &
|
|
6
|
+
} & HTMLProps<HTMLFieldSetElement> & Omit<FrameProps<'fieldset'>, 'as'>;
|
|
6
7
|
export declare const Fieldset: React.ForwardRefExoticComponent<Omit<FieldSetProps, "ref"> & React.RefAttributes<HTMLFieldSetElement>>;
|