@react95/core 8.1.3 → 9.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 +0 -21
- package/cjs/Alert/Alert.cjs +21 -13
- package/cjs/Modal/Modal.cjs +81 -96
- package/cjs/Modal/Modal.css.ts.vanilla.css +6 -4
- package/cjs/TaskBar/TaskBar.cjs +40 -7
- package/cjs/TitleBar/TitleBar.cjs +71 -7
- package/cjs/TitleBar/TitleBar.css.ts.vanilla.css +8 -1
- package/cjs/TitleBar/maximize.svg.cjs +3 -0
- package/cjs/TitleBar/minimize.svg.cjs +3 -0
- package/cjs/TitleBar/restore.svg.cjs +3 -0
- package/cjs/index.cjs +0 -4
- package/cjs/shared/events.cjs +35 -0
- package/esm/Alert/Alert.mjs +21 -13
- package/esm/Modal/Modal.css.ts.vanilla.css +6 -4
- package/esm/Modal/Modal.mjs +83 -98
- package/esm/TaskBar/TaskBar.mjs +41 -8
- package/esm/TitleBar/TitleBar.css.ts.vanilla.css +8 -1
- package/esm/TitleBar/TitleBar.mjs +73 -9
- package/esm/TitleBar/maximize.svg.mjs +4 -0
- package/esm/TitleBar/minimize.svg.mjs +4 -0
- package/esm/TitleBar/restore.svg.mjs +4 -0
- package/esm/index.mjs +0 -4
- package/esm/shared/events.mjs +35 -0
- package/package.json +4 -8
- package/types/Cursor/Cursor.css.d.ts +1 -1
- package/types/Modal/Modal.d.ts +2259 -11
- package/types/TaskBar/WindowButton.d.ts +3 -3
- package/types/TitleBar/TitleBar.d.ts +2271 -3
- package/types/index.d.ts +1 -3
- package/types/shared/events.d.ts +19 -0
- package/cjs/Modal/ModalContext.cjs +0 -16
- package/cjs/Modal/ModalProvider.cjs +0 -56
- package/esm/Modal/ModalContext.mjs +0 -16
- package/esm/Modal/ModalProvider.mjs +0 -56
- package/types/Modal/ModalContext.d.ts +0 -15
- package/types/Modal/ModalProvider.d.ts +0 -3
- /package/cjs/{Modal → TitleBar}/close.svg.cjs +0 -0
- /package/cjs/{Modal → TitleBar}/help.svg.cjs +0 -0
- /package/esm/{Modal → TitleBar}/close.svg.mjs +0 -0
- /package/esm/{Modal → TitleBar}/help.svg.mjs +0 -0
package/README.md
CHANGED
|
@@ -42,27 +42,6 @@ export const MyApp = () => {
|
|
|
42
42
|
|
|
43
43
|
You can find a list of all available components on our [Storybook page](https://react95.github.io/React95/).
|
|
44
44
|
|
|
45
|
-
### About `Modal`
|
|
46
|
-
|
|
47
|
-
The `Modal` component is managed with `ModalContext`.
|
|
48
|
-
To ensure they are managed correctly, surround one or a group of Modals with a `<ModalProvider>`. Example:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
import { ModalProvider, Modal } from '@react95/core';
|
|
52
|
-
|
|
53
|
-
export const ModalExample = () => {
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<ModalProvider>
|
|
57
|
-
<Modal title="Modal 1" />
|
|
58
|
-
<Modal title="Modal 2" />
|
|
59
|
-
...
|
|
60
|
-
</ModalProvider>
|
|
61
|
-
</>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
```
|
|
65
|
-
|
|
66
45
|
### Next.JS
|
|
67
46
|
|
|
68
47
|
If you want to use React95 on a NextJS project, check the [NextJS template](https://github.com/React95/nextjs-template)
|
package/cjs/Alert/Alert.cjs
CHANGED
|
@@ -19,25 +19,33 @@ const RenderImage = ({ option }) => {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const Alert = React.forwardRef(
|
|
22
|
-
({ type = "error", message, hasSound, ...rest }, ref) => {
|
|
22
|
+
({ type = "error", message, hasSound = false, dragOptions, ...rest }, ref) => {
|
|
23
23
|
if (hasSound) {
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
const audio = new Audio(chord);
|
|
26
26
|
audio.play();
|
|
27
27
|
}, []);
|
|
28
28
|
}
|
|
29
|
-
return /* @__PURE__ */ React.createElement(
|
|
29
|
+
return /* @__PURE__ */ React.createElement(
|
|
30
|
+
Modal.Modal,
|
|
31
|
+
{
|
|
32
|
+
height: "120",
|
|
33
|
+
dragOptions: {
|
|
34
|
+
defaultPosition: {
|
|
35
|
+
x: typeof window == "undefined" ? 0 : Math.floor(window.innerWidth / 2) - 150,
|
|
36
|
+
y: typeof window == "undefined" ? 0 : Math.floor(window.innerHeight / 2) - 100
|
|
37
|
+
},
|
|
38
|
+
...dragOptions
|
|
39
|
+
},
|
|
40
|
+
buttons: [{ value: "OK", onClick: () => {
|
|
41
|
+
} }],
|
|
42
|
+
hasWindowButton: false,
|
|
43
|
+
buttonsAlignment: "center",
|
|
44
|
+
...rest,
|
|
45
|
+
ref
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ React.createElement(Modal.Modal.Content, { className: Alert_css.dialog }, /* @__PURE__ */ React.createElement("div", { className: Alert_css.icon }, /* @__PURE__ */ React.createElement(RenderImage, { option: type })), /* @__PURE__ */ React.createElement("div", { className: Alert_css.message }, message))
|
|
48
|
+
);
|
|
30
49
|
}
|
|
31
50
|
);
|
|
32
|
-
Alert.defaultProps = {
|
|
33
|
-
type: "error",
|
|
34
|
-
buttons: [{ value: "OK", onClick: () => {
|
|
35
|
-
} }],
|
|
36
|
-
buttonsAlignment: "center",
|
|
37
|
-
positionOffset: {
|
|
38
|
-
x: typeof window == "undefined" ? 0 : Math.floor(window.innerWidth / 2) - 150,
|
|
39
|
-
y: typeof window == "undefined" ? 0 : Math.floor(window.innerHeight / 2) - 100
|
|
40
|
-
},
|
|
41
|
-
hasSound: false
|
|
42
|
-
};
|
|
43
51
|
exports.Alert = Alert;
|
package/cjs/Modal/Modal.cjs
CHANGED
|
@@ -1,132 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const nanoid = require("nanoid");
|
|
3
4
|
const React = require("react");
|
|
4
|
-
const
|
|
5
|
+
const react = require("@neodrag/react");
|
|
5
6
|
const Button = require("../Button/Button.cjs");
|
|
7
|
+
const Frame = require("../Frame/Frame.cjs");
|
|
6
8
|
const TitleBar = require("../TitleBar/TitleBar.cjs");
|
|
7
|
-
const ModalContext = require("./ModalContext.cjs");
|
|
8
9
|
const Modal_css = require("./Modal.css.cjs");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const cn = require("classnames");
|
|
11
|
+
const usehooksTs = require("usehooks-ts");
|
|
12
|
+
const events = require("../shared/events.cjs");
|
|
13
|
+
const ModalContent = Frame.fixedForwardRef(
|
|
14
|
+
(rest, ref) => /* @__PURE__ */ React.createElement(Frame.Frame, { ...rest, ref, className: cn(Modal_css.content, rest.className) })
|
|
15
|
+
);
|
|
12
16
|
const ModalRenderer = ({
|
|
13
17
|
hasWindowButton: hasButton = true,
|
|
14
18
|
buttons = [],
|
|
15
19
|
buttonsAlignment = "flex-end",
|
|
16
20
|
children,
|
|
17
|
-
onClose = () => {
|
|
18
|
-
},
|
|
19
|
-
onHelp,
|
|
20
|
-
defaultPosition = { x: 0, y: 0 },
|
|
21
|
-
positionOffset,
|
|
22
|
-
height,
|
|
23
21
|
icon,
|
|
24
22
|
menu = [],
|
|
25
23
|
title,
|
|
26
|
-
|
|
24
|
+
dragOptions,
|
|
25
|
+
titleBarOptions,
|
|
26
|
+
className,
|
|
27
27
|
...rest
|
|
28
28
|
}, ref) => {
|
|
29
|
-
const
|
|
30
|
-
addWindows,
|
|
31
|
-
removeWindow,
|
|
32
|
-
updateWindow,
|
|
33
|
-
setActiveWindow,
|
|
34
|
-
activeWindow
|
|
35
|
-
} = React.useContext(ModalContext.ModalContext);
|
|
36
|
-
const [id, setId] = React.useState(null);
|
|
29
|
+
const [id] = React.useState(nanoid.nanoid());
|
|
37
30
|
const [menuOpened, setMenuOpened] = React.useState("");
|
|
38
31
|
const [isActive, setIsActive] = React.useState(false);
|
|
32
|
+
const draggableRef = React.useRef(null);
|
|
33
|
+
react.useDraggable(draggableRef, {
|
|
34
|
+
...dragOptions,
|
|
35
|
+
handle: ".draggable"
|
|
36
|
+
});
|
|
37
|
+
const menuRef = React.useRef(null);
|
|
38
|
+
usehooksTs.useOnClickOutside(menuRef, () => {
|
|
39
|
+
setMenuOpened("");
|
|
40
|
+
});
|
|
39
41
|
React.useEffect(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
React.useEffect(() => {
|
|
42
|
+
events.modals.emit(events.ModalEvents.AddModal, {
|
|
43
|
+
icon,
|
|
44
|
+
title,
|
|
45
|
+
id,
|
|
46
|
+
hasButton
|
|
47
|
+
});
|
|
48
|
+
events.modals.on(events.ModalEvents.ModalVisibilityChanged, ({ id: activeId }) => {
|
|
49
|
+
setIsActive(activeId === id);
|
|
50
|
+
});
|
|
51
|
+
events.modals.emit(events.ModalEvents.ModalVisibilityChanged, { id });
|
|
51
52
|
return () => {
|
|
52
|
-
|
|
53
|
-
removeWindow(id);
|
|
54
|
-
}
|
|
53
|
+
events.modals.emit(events.ModalEvents.RemoveModal, { id });
|
|
55
54
|
};
|
|
56
|
-
}, [
|
|
57
|
-
React.
|
|
55
|
+
}, []);
|
|
56
|
+
React.useImperativeHandle(ref, () => {
|
|
57
|
+
return draggableRef.current;
|
|
58
|
+
});
|
|
58
59
|
return /* @__PURE__ */ React.createElement(
|
|
59
|
-
|
|
60
|
+
Frame.Frame,
|
|
60
61
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onMouseDown:
|
|
62
|
+
...rest,
|
|
63
|
+
className: cn(Modal_css.modalWrapper({ active: isActive }), className),
|
|
64
|
+
ref: draggableRef,
|
|
65
|
+
onMouseDown: () => {
|
|
66
|
+
events.modals.emit(events.ModalEvents.ModalVisibilityChanged, { id });
|
|
67
|
+
}
|
|
65
68
|
},
|
|
66
69
|
/* @__PURE__ */ React.createElement(
|
|
67
|
-
|
|
70
|
+
TitleBar.TitleBar,
|
|
68
71
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
className:
|
|
73
|
-
ref
|
|
72
|
+
active: isActive,
|
|
73
|
+
icon,
|
|
74
|
+
title,
|
|
75
|
+
className: "draggable"
|
|
74
76
|
},
|
|
75
|
-
/* @__PURE__ */ React.createElement(
|
|
76
|
-
|
|
77
|
+
titleBarOptions && /* @__PURE__ */ React.createElement(TitleBar.TitleBar.OptionsBox, null, titleBarOptions)
|
|
78
|
+
),
|
|
79
|
+
menu && menu.length > 0 && /* @__PURE__ */ React.createElement("ul", { className: Modal_css.menuWrapper, ref: menuRef }, menu.map(({ name, list }) => {
|
|
80
|
+
const active = menuOpened === name;
|
|
81
|
+
return /* @__PURE__ */ React.createElement(
|
|
82
|
+
"li",
|
|
77
83
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
className: "draggable"
|
|
84
|
+
key: name,
|
|
85
|
+
onMouseDown: () => setMenuOpened(name),
|
|
86
|
+
className: Modal_css.menuItem({ active })
|
|
82
87
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
97
|
-
})),
|
|
98
|
-
/* @__PURE__ */ React.createElement("div", { className: Modal_css.content, onClick: () => setMenuOpened("") }, children),
|
|
99
|
-
buttons && buttons.length > 0 && /* @__PURE__ */ React.createElement(
|
|
100
|
-
Frame.Frame,
|
|
88
|
+
name,
|
|
89
|
+
active && list
|
|
90
|
+
);
|
|
91
|
+
})),
|
|
92
|
+
children,
|
|
93
|
+
buttons && buttons.length > 0 && /* @__PURE__ */ React.createElement(
|
|
94
|
+
Frame.Frame,
|
|
95
|
+
{
|
|
96
|
+
className: Modal_css.buttonWrapper,
|
|
97
|
+
justifyContent: buttonsAlignment
|
|
98
|
+
},
|
|
99
|
+
buttons.map((button) => /* @__PURE__ */ React.createElement(
|
|
100
|
+
Button.Button,
|
|
101
101
|
{
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
key: button.value,
|
|
103
|
+
onClick: button.onClick,
|
|
104
|
+
value: button.value
|
|
104
105
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
key: button.value,
|
|
109
|
-
onClick: button.onClick,
|
|
110
|
-
value: button.value
|
|
111
|
-
},
|
|
112
|
-
button.value
|
|
113
|
-
))
|
|
114
|
-
)
|
|
106
|
+
button.value
|
|
107
|
+
))
|
|
115
108
|
)
|
|
116
109
|
);
|
|
117
110
|
};
|
|
118
|
-
const Modal =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
title: "Modal",
|
|
123
|
-
children: null,
|
|
124
|
-
defaultPosition: { x: 0, y: 0 },
|
|
125
|
-
buttons: [],
|
|
126
|
-
menu: [],
|
|
127
|
-
width: void 0,
|
|
128
|
-
height: void 0,
|
|
129
|
-
onClose: () => {
|
|
111
|
+
const Modal = Object.assign(
|
|
112
|
+
Frame.fixedForwardRef(ModalRenderer),
|
|
113
|
+
{
|
|
114
|
+
Content: ModalContent
|
|
130
115
|
}
|
|
131
|
-
|
|
116
|
+
);
|
|
132
117
|
exports.Modal = Modal;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
position: fixed;
|
|
5
|
-
padding:
|
|
5
|
+
padding: var(--r95-space-2);
|
|
6
6
|
top: 50px;
|
|
7
7
|
background-color: var(--r95-color-material);
|
|
8
8
|
box-shadow: var(--r95-shadow-out);
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
}
|
|
13
13
|
.r95_1txblt62 {
|
|
14
14
|
display: flex;
|
|
15
|
-
gap:
|
|
15
|
+
gap: var(--r95-space-6);
|
|
16
16
|
flex-direction: row;
|
|
17
|
-
padding:
|
|
17
|
+
padding: var(--r95-space-6);
|
|
18
18
|
}
|
|
19
19
|
.r95_1txblt62 button {
|
|
20
20
|
min-width: 70px;
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
flex-grow: 1;
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
|
-
padding:
|
|
26
|
+
padding: var(--r95-space-6);
|
|
27
|
+
margin-block-start: var(--r95-space-4);
|
|
28
|
+
margin-inline-end: var(--r95-space-1);
|
|
27
29
|
}
|
|
28
30
|
.r95_1txblt64 {
|
|
29
31
|
display: flex;
|
package/cjs/TaskBar/TaskBar.cjs
CHANGED
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const ModalContext = require("../Modal/ModalContext.cjs");
|
|
5
4
|
const Frame = require("../Frame/Frame.cjs");
|
|
6
5
|
const Clock = require("./Clock.cjs");
|
|
7
6
|
const WindowButton = require("./WindowButton.cjs");
|
|
8
7
|
const icons = require("@react95/icons");
|
|
9
8
|
const TaskBar_css = require("./TaskBar.css.cjs");
|
|
9
|
+
const events = require("../shared/events.cjs");
|
|
10
10
|
const TaskBar = React.forwardRef(
|
|
11
11
|
({ list }, ref) => {
|
|
12
12
|
const [showList, toggleShowList] = React.useState(false);
|
|
13
13
|
const [activeStart, toggleActiveStart] = React.useState(false);
|
|
14
|
-
const
|
|
14
|
+
const [modalWindows, setModalWindows] = React.useState([]);
|
|
15
|
+
const [activeWindow, setActiveWindow] = React.useState();
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
const addModal = (window) => {
|
|
18
|
+
setModalWindows((prevModals) => [...prevModals, window]);
|
|
19
|
+
};
|
|
20
|
+
const removeModal = (data) => {
|
|
21
|
+
setModalWindows((prevModals) => {
|
|
22
|
+
const filteredModals = prevModals.filter(
|
|
23
|
+
(modal) => modal.id !== data.id
|
|
24
|
+
);
|
|
25
|
+
const lastModal = filteredModals.at(-1);
|
|
26
|
+
if (!activeWindow && lastModal) {
|
|
27
|
+
events.modals.emit(events.ModalEvents.ModalVisibilityChanged, {
|
|
28
|
+
id: lastModal == null ? void 0 : lastModal.id
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return filteredModals;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const updateVisibleModal = ({ id }) => {
|
|
35
|
+
setActiveWindow(id);
|
|
36
|
+
};
|
|
37
|
+
events.modals.on(events.ModalEvents.AddModal, addModal);
|
|
38
|
+
events.modals.on(events.ModalEvents.RemoveModal, removeModal);
|
|
39
|
+
events.modals.on(events.ModalEvents.ModalVisibilityChanged, updateVisibleModal);
|
|
40
|
+
return () => {
|
|
41
|
+
events.modals.off(events.ModalEvents.AddModal, addModal);
|
|
42
|
+
events.modals.off(events.ModalEvents.RemoveModal, removeModal);
|
|
43
|
+
events.modals.off(events.ModalEvents.ModalVisibilityChanged, updateVisibleModal);
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
15
46
|
return /* @__PURE__ */ React.createElement(
|
|
16
47
|
Frame.Frame,
|
|
17
48
|
{
|
|
@@ -54,14 +85,16 @@ const TaskBar = React.forwardRef(
|
|
|
54
85
|
},
|
|
55
86
|
"Start"
|
|
56
87
|
),
|
|
57
|
-
/* @__PURE__ */ React.createElement(Frame.Frame, { w: "100%", paddingLeft: "$0", ml: "$2", display: "flex" },
|
|
58
|
-
(
|
|
88
|
+
/* @__PURE__ */ React.createElement(Frame.Frame, { w: "100%", paddingLeft: "$0", ml: "$2", display: "flex" }, modalWindows.map(
|
|
89
|
+
({ icon, title, hasButton, id }) => hasButton && /* @__PURE__ */ React.createElement(
|
|
59
90
|
WindowButton.WindowButton,
|
|
60
91
|
{
|
|
61
|
-
key:
|
|
92
|
+
key: id,
|
|
62
93
|
icon,
|
|
63
|
-
active:
|
|
64
|
-
onClick: () =>
|
|
94
|
+
active: id === activeWindow,
|
|
95
|
+
onClick: () => {
|
|
96
|
+
events.modals.emit(events.ModalEvents.ModalVisibilityChanged, { id });
|
|
97
|
+
},
|
|
65
98
|
small: false
|
|
66
99
|
},
|
|
67
100
|
/* @__PURE__ */ React.createElement("div", { className: TaskBar_css.truncate }, title)
|
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cn = require("classnames");
|
|
3
4
|
const React = require("react");
|
|
5
|
+
const close = require("./close.svg.cjs");
|
|
6
|
+
const help = require("./help.svg.cjs");
|
|
7
|
+
const maximize = require("./maximize.svg.cjs");
|
|
8
|
+
const minimize = require("./minimize.svg.cjs");
|
|
9
|
+
const restore = require("./restore.svg.cjs");
|
|
4
10
|
const Frame = require("../Frame/Frame.cjs");
|
|
5
|
-
const TitleBar_css = require("./TitleBar.css.cjs");
|
|
6
11
|
const Button_css = require("../Button/Button.css.cjs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
12
|
+
const TitleBar_css = require("./TitleBar.css.cjs");
|
|
13
|
+
const defaultOptions = {
|
|
14
|
+
help: {
|
|
15
|
+
alt: "help",
|
|
16
|
+
src: help
|
|
17
|
+
},
|
|
18
|
+
close: {
|
|
19
|
+
alt: "close",
|
|
20
|
+
src: close
|
|
21
|
+
},
|
|
22
|
+
maximize: {
|
|
23
|
+
alt: "maximize",
|
|
24
|
+
src: maximize
|
|
25
|
+
},
|
|
26
|
+
minimize: {
|
|
27
|
+
alt: "minimize",
|
|
28
|
+
src: minimize
|
|
29
|
+
},
|
|
30
|
+
restore: {
|
|
31
|
+
alt: "restore",
|
|
32
|
+
src: restore
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const OptionsBox = Frame.fixedForwardRef(
|
|
9
36
|
(rest, ref) => /* @__PURE__ */ React.createElement(
|
|
10
37
|
Frame.Frame,
|
|
11
38
|
{
|
|
@@ -15,17 +42,49 @@ const OptionsBox = React.forwardRef(
|
|
|
15
42
|
}
|
|
16
43
|
)
|
|
17
44
|
);
|
|
18
|
-
const Option =
|
|
45
|
+
const Option = Frame.fixedForwardRef(
|
|
19
46
|
(rest, ref) => /* @__PURE__ */ React.createElement(
|
|
20
47
|
Frame.Frame,
|
|
21
48
|
{
|
|
49
|
+
as: "button",
|
|
22
50
|
...rest,
|
|
23
51
|
ref,
|
|
24
|
-
as: "button",
|
|
25
52
|
className: cn(Button_css.button, TitleBar_css.option, rest.className)
|
|
26
53
|
}
|
|
27
54
|
)
|
|
28
55
|
);
|
|
56
|
+
const DefaultOption = Frame.fixedForwardRef(
|
|
57
|
+
(props, ref) => {
|
|
58
|
+
const { kind, ...rest } = props;
|
|
59
|
+
const optionType = defaultOptions[kind] || defaultOptions.help;
|
|
60
|
+
return /* @__PURE__ */ React.createElement(Option, { ...rest, ref }, /* @__PURE__ */ React.createElement("img", { src: optionType.src, alt: optionType.alt }));
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
const Help = Frame.fixedForwardRef(
|
|
64
|
+
(props, ref) => {
|
|
65
|
+
return /* @__PURE__ */ React.createElement(DefaultOption, { ...props, kind: "help", ref });
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
const Close = Frame.fixedForwardRef(
|
|
69
|
+
(props, ref) => {
|
|
70
|
+
return /* @__PURE__ */ React.createElement(DefaultOption, { ...props, kind: "close", ref });
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const Maximize = Frame.fixedForwardRef(
|
|
74
|
+
(props, ref) => {
|
|
75
|
+
return /* @__PURE__ */ React.createElement(DefaultOption, { ...props, kind: "maximize", ref });
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
const Minimize = Frame.fixedForwardRef(
|
|
79
|
+
(props, ref) => {
|
|
80
|
+
return /* @__PURE__ */ React.createElement(DefaultOption, { ...props, kind: "minimize", ref });
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
const Restore = Frame.fixedForwardRef(
|
|
84
|
+
(props, ref) => {
|
|
85
|
+
return /* @__PURE__ */ React.createElement(DefaultOption, { ...props, kind: "restore", ref });
|
|
86
|
+
}
|
|
87
|
+
);
|
|
29
88
|
const TitleBarRenderer = ({ children, title = "UNKNOWN.EXE", icon, active = true, ...rest }, ref) => /* @__PURE__ */ React.createElement(
|
|
30
89
|
Frame.Frame,
|
|
31
90
|
{
|
|
@@ -38,10 +97,15 @@ const TitleBarRenderer = ({ children, title = "UNKNOWN.EXE", icon, active = true
|
|
|
38
97
|
children
|
|
39
98
|
);
|
|
40
99
|
const TitleBar = Object.assign(
|
|
41
|
-
|
|
100
|
+
Frame.fixedForwardRef(TitleBarRenderer),
|
|
42
101
|
{
|
|
43
102
|
Option,
|
|
44
|
-
OptionsBox
|
|
103
|
+
OptionsBox,
|
|
104
|
+
Help,
|
|
105
|
+
Close,
|
|
106
|
+
Maximize,
|
|
107
|
+
Minimize,
|
|
108
|
+
Restore
|
|
45
109
|
}
|
|
46
110
|
);
|
|
47
111
|
exports.TitleBar = TitleBar;
|
|
@@ -49,10 +49,17 @@
|
|
|
49
49
|
.r95_1kpzw682 svg {
|
|
50
50
|
width: var(--r95-space-16);
|
|
51
51
|
height: var(--r95-space-16);
|
|
52
|
-
margin-
|
|
52
|
+
margin-inline-end: var(--r95-space-4);
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
|
+
.r95_1kpzw681 svg {
|
|
56
|
+
width: var(--r95-space-14);
|
|
57
|
+
height: var(--r95-space-14);
|
|
58
|
+
margin-inline-end: unset;
|
|
53
59
|
}
|
|
54
60
|
.r95_1kpzw685 {
|
|
55
61
|
flex-grow: 1;
|
|
62
|
+
flex-shrink: 0;
|
|
56
63
|
line-height: 1.4em;
|
|
57
64
|
margin: 0;
|
|
58
65
|
font-size: 1em;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const maximize = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nOScgaGVpZ2h0PSc5JyBmaWxsPSdjdXJyZW50Q29sb3InIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J005IDBIMHY5aDlWMHpNOCAySDF2Nmg3VjJ6JyAvPjwvc3ZnPg==";
|
|
3
|
+
module.exports = maximize;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const restore = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nOCcgaGVpZ2h0PSc5JyBmaWxsPSdjdXJyZW50Q29sb3InIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTIgMGg2djJIMnpNNyAyaDF2NEg3ek0yIDJoMXYxSDJ6TTYgNWgxdjFINnpNMCAzaDZ2Mkgwek01IDVoMXY0SDV6TTAgNWgxdjRIMHpNMSA4aDR2MUgxeicvPjwvc3ZnPg==";
|
|
3
|
+
module.exports = restore;
|
package/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const Modal = require("./Modal/Modal.cjs");
|
|
4
|
-
const ModalContext = require("./Modal/ModalContext.cjs");
|
|
5
|
-
const ModalProvider = require("./Modal/ModalProvider.cjs");
|
|
6
4
|
const Tabs = require("./Tabs/Tabs.cjs");
|
|
7
5
|
const Tab = require("./Tabs/Tab.cjs");
|
|
8
6
|
const Alert = require("./Alert/Alert.cjs");
|
|
@@ -25,8 +23,6 @@ const Tooltip = require("./Tooltip/Tooltip.cjs");
|
|
|
25
23
|
const TitleBar = require("./TitleBar/TitleBar.cjs");
|
|
26
24
|
const Video = require("./Video/Video.cjs");
|
|
27
25
|
exports.Modal = Modal.Modal;
|
|
28
|
-
exports.ModalContext = ModalContext.ModalContext;
|
|
29
|
-
exports.ModalProvider = ModalProvider.ModalProvider;
|
|
30
26
|
exports.Tabs = Tabs.Tabs;
|
|
31
27
|
exports.Tab = Tab.Tab;
|
|
32
28
|
exports.Alert = Alert.Alert;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class Emitter {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.listeners = {};
|
|
6
|
+
}
|
|
7
|
+
on(eventName, callback) {
|
|
8
|
+
if (!this.listeners[eventName]) {
|
|
9
|
+
this.listeners[eventName] = [];
|
|
10
|
+
}
|
|
11
|
+
this.listeners[eventName].push(callback);
|
|
12
|
+
}
|
|
13
|
+
off(eventName, callback) {
|
|
14
|
+
if (this.listeners[eventName]) {
|
|
15
|
+
this.listeners[eventName] = this.listeners[eventName].filter(
|
|
16
|
+
(cb) => cb !== callback
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
emit(eventName, data) {
|
|
21
|
+
if (this.listeners[eventName]) {
|
|
22
|
+
this.listeners[eventName].forEach((callback) => callback(data));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var ModalEvents = /* @__PURE__ */ ((ModalEvents2) => {
|
|
27
|
+
ModalEvents2["AddModal"] = "add-modal";
|
|
28
|
+
ModalEvents2["RemoveModal"] = "remove-modal";
|
|
29
|
+
ModalEvents2["ModalVisibilityChanged"] = "modal-visibility-changed";
|
|
30
|
+
return ModalEvents2;
|
|
31
|
+
})(ModalEvents || {});
|
|
32
|
+
const modals = new Emitter();
|
|
33
|
+
exports.Emitter = Emitter;
|
|
34
|
+
exports.ModalEvents = ModalEvents;
|
|
35
|
+
exports.modals = modals;
|
package/esm/Alert/Alert.mjs
CHANGED
|
@@ -17,27 +17,35 @@ const RenderImage = ({ option }) => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const Alert = forwardRef(
|
|
20
|
-
({ type = "error", message: message$1, hasSound, ...rest }, ref) => {
|
|
20
|
+
({ type = "error", message: message$1, hasSound = false, dragOptions, ...rest }, ref) => {
|
|
21
21
|
if (hasSound) {
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const audio = new Audio(sound);
|
|
24
24
|
audio.play();
|
|
25
25
|
}, []);
|
|
26
26
|
}
|
|
27
|
-
return /* @__PURE__ */ React.createElement(
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
Modal,
|
|
29
|
+
{
|
|
30
|
+
height: "120",
|
|
31
|
+
dragOptions: {
|
|
32
|
+
defaultPosition: {
|
|
33
|
+
x: typeof window == "undefined" ? 0 : Math.floor(window.innerWidth / 2) - 150,
|
|
34
|
+
y: typeof window == "undefined" ? 0 : Math.floor(window.innerHeight / 2) - 100
|
|
35
|
+
},
|
|
36
|
+
...dragOptions
|
|
37
|
+
},
|
|
38
|
+
buttons: [{ value: "OK", onClick: () => {
|
|
39
|
+
} }],
|
|
40
|
+
hasWindowButton: false,
|
|
41
|
+
buttonsAlignment: "center",
|
|
42
|
+
...rest,
|
|
43
|
+
ref
|
|
44
|
+
},
|
|
45
|
+
/* @__PURE__ */ React.createElement(Modal.Content, { className: dialog }, /* @__PURE__ */ React.createElement("div", { className: icon }, /* @__PURE__ */ React.createElement(RenderImage, { option: type })), /* @__PURE__ */ React.createElement("div", { className: message }, message$1))
|
|
46
|
+
);
|
|
28
47
|
}
|
|
29
48
|
);
|
|
30
|
-
Alert.defaultProps = {
|
|
31
|
-
type: "error",
|
|
32
|
-
buttons: [{ value: "OK", onClick: () => {
|
|
33
|
-
} }],
|
|
34
|
-
buttonsAlignment: "center",
|
|
35
|
-
positionOffset: {
|
|
36
|
-
x: typeof window == "undefined" ? 0 : Math.floor(window.innerWidth / 2) - 150,
|
|
37
|
-
y: typeof window == "undefined" ? 0 : Math.floor(window.innerHeight / 2) - 100
|
|
38
|
-
},
|
|
39
|
-
hasSound: false
|
|
40
|
-
};
|
|
41
49
|
export {
|
|
42
50
|
Alert
|
|
43
51
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
position: fixed;
|
|
5
|
-
padding:
|
|
5
|
+
padding: var(--r95-space-2);
|
|
6
6
|
top: 50px;
|
|
7
7
|
background-color: var(--r95-color-material);
|
|
8
8
|
box-shadow: var(--r95-shadow-out);
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
}
|
|
13
13
|
.r95_1txblt62 {
|
|
14
14
|
display: flex;
|
|
15
|
-
gap:
|
|
15
|
+
gap: var(--r95-space-6);
|
|
16
16
|
flex-direction: row;
|
|
17
|
-
padding:
|
|
17
|
+
padding: var(--r95-space-6);
|
|
18
18
|
}
|
|
19
19
|
.r95_1txblt62 button {
|
|
20
20
|
min-width: 70px;
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
flex-grow: 1;
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
|
-
padding:
|
|
26
|
+
padding: var(--r95-space-6);
|
|
27
|
+
margin-block-start: var(--r95-space-4);
|
|
28
|
+
margin-inline-end: var(--r95-space-1);
|
|
27
29
|
}
|
|
28
30
|
.r95_1txblt64 {
|
|
29
31
|
display: flex;
|