ar-design 0.2.63 → 0.2.65
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/dist/assets/css/components/feedback/popup/popup.css +179 -0
- package/dist/components/data-display/table/index.js +1 -1
- package/dist/components/feedback/notification/index.js +1 -0
- package/dist/components/feedback/popover/IProps.d.ts +2 -2
- package/dist/components/feedback/popover/index.js +2 -2
- package/dist/components/feedback/popup/IProps.d.ts +9 -0
- package/dist/components/feedback/popup/IProps.js +1 -0
- package/dist/components/feedback/popup/index.d.ts +5 -0
- package/dist/components/feedback/popup/index.js +33 -0
- package/dist/components/form/date-picker/DATE.js +2 -2
- package/dist/libs/core/application/contexts/Notification.d.ts +8 -0
- package/dist/libs/core/application/contexts/Notification.js +7 -1
- package/dist/libs/core/application/hooks/index.d.ts +7 -1
- package/dist/libs/core/application/hooks/index.js +9 -2
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
.ar-notification-popup {
|
|
2
|
+
visibility: hidden;
|
|
3
|
+
opacity: 0;
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 50%;
|
|
6
|
+
left: 50%;
|
|
7
|
+
transform-origin: top;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 1.5rem;
|
|
13
|
+
background-color: var(--white);
|
|
14
|
+
width: 450px;
|
|
15
|
+
padding: 1rem 2rem;
|
|
16
|
+
border-radius: var(--border-radius-sm);
|
|
17
|
+
box-shadow: 0 5px 15px -5px rgba(var(--black-rgb), 0.25);
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
z-index: 1051;
|
|
20
|
+
}
|
|
21
|
+
.ar-notification-popup.open {
|
|
22
|
+
animation: openPopup 1s ease 0s 1 normal forwards;
|
|
23
|
+
}
|
|
24
|
+
.ar-notification-popup.closed {
|
|
25
|
+
animation: closedPopup ease-in-out 500ms 0s 1 normal both;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ar-notification-popup > .icon {
|
|
29
|
+
width: 5rem;
|
|
30
|
+
height: 5rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ar-notification-popup > .icon.success {
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
background-color: var(--success);
|
|
39
|
+
border-radius: var(--border-radius-pill);
|
|
40
|
+
box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.25);
|
|
41
|
+
}
|
|
42
|
+
.ar-notification-popup > .icon.success::before {
|
|
43
|
+
content: "";
|
|
44
|
+
width: 4rem;
|
|
45
|
+
height: 1.75rem;
|
|
46
|
+
transform: rotate(-45deg);
|
|
47
|
+
border: solid 10.5px transparent;
|
|
48
|
+
border-radius: var(--border-radius-sm);
|
|
49
|
+
border-left-color: var(--white);
|
|
50
|
+
border-bottom-color: var(--white);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ar-notification-popup > .icon.error {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: center;
|
|
58
|
+
background-color: var(--danger);
|
|
59
|
+
border-radius: var(--border-radius-pill);
|
|
60
|
+
box-shadow: 0 0 0 5px rgba(var(--danger-rgb), 0.25);
|
|
61
|
+
}
|
|
62
|
+
.ar-notification-popup > .icon.error::before {
|
|
63
|
+
position: absolute;
|
|
64
|
+
content: "";
|
|
65
|
+
background-color: var(--white);
|
|
66
|
+
width: 10.5px;
|
|
67
|
+
height: 3.5rem;
|
|
68
|
+
transform: rotate(-45deg);
|
|
69
|
+
border-radius: var(--border-radius-sm);
|
|
70
|
+
}
|
|
71
|
+
.ar-notification-popup > .icon.error::after {
|
|
72
|
+
position: absolute;
|
|
73
|
+
content: "";
|
|
74
|
+
background-color: var(--white);
|
|
75
|
+
width: 10.5px;
|
|
76
|
+
height: 3.5rem;
|
|
77
|
+
transform: rotate(45deg);
|
|
78
|
+
border-radius: var(--border-radius-sm);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ar-notification-popup > .content {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
gap: 0.75rem 0;
|
|
86
|
+
width: 100%;
|
|
87
|
+
padding: 0 1rem;
|
|
88
|
+
color: var(--gray-700);
|
|
89
|
+
}
|
|
90
|
+
.ar-notification-popup > .content > .title {
|
|
91
|
+
font-size: 1.75rem;
|
|
92
|
+
text-align: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ar-notification-popup > .content > .title.success {
|
|
96
|
+
color: var(--success);
|
|
97
|
+
}
|
|
98
|
+
.ar-notification-popup > .content > .title.error {
|
|
99
|
+
color: var(--danger);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ar-notification-popup > .content > .message {
|
|
103
|
+
color: var(--gray-600);
|
|
104
|
+
text-align: center;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media only screen and (max-width: 480px) {
|
|
108
|
+
.ar-notification.top-left {
|
|
109
|
+
inset: 1rem 1rem auto 1rem;
|
|
110
|
+
}
|
|
111
|
+
.ar-notification.top-right {
|
|
112
|
+
inset: 1rem 1rem auto 1rem;
|
|
113
|
+
}
|
|
114
|
+
.ar-notification.bottom-left {
|
|
115
|
+
inset: auto 1rem 1rem 1rem;
|
|
116
|
+
}
|
|
117
|
+
.ar-notification.bottom-right {
|
|
118
|
+
inset: auto 1rem 1rem 1rem;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@keyframes openPopup {
|
|
123
|
+
0% {
|
|
124
|
+
visibility: hidden;
|
|
125
|
+
opacity: 0;
|
|
126
|
+
animation-timing-function: ease-in;
|
|
127
|
+
opacity: 0;
|
|
128
|
+
transform: scale(0) translate(-50%, -50%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
38% {
|
|
132
|
+
animation-timing-function: ease-out;
|
|
133
|
+
opacity: 1;
|
|
134
|
+
transform: scale(1) translate(-50%, -50%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
55% {
|
|
138
|
+
animation-timing-function: ease-in;
|
|
139
|
+
transform: scale(0.7) translate(-50%, -50%);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
72% {
|
|
143
|
+
animation-timing-function: ease-out;
|
|
144
|
+
transform: scale(1) translate(-50%, -50%);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
81% {
|
|
148
|
+
animation-timing-function: ease-in;
|
|
149
|
+
transform: scale(0.84) translate(-50%, -50%);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
89% {
|
|
153
|
+
animation-timing-function: ease-out;
|
|
154
|
+
transform: scale(1) translate(-50%, -50%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
95% {
|
|
158
|
+
animation-timing-function: ease-in;
|
|
159
|
+
transform: scale(0.95) translate(-50%, -50%);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
100% {
|
|
163
|
+
visibility: visible;
|
|
164
|
+
opacity: 1;
|
|
165
|
+
animation-timing-function: ease-out;
|
|
166
|
+
transform: scale(1) translate(-50%, -50%);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@keyframes closedPopup {
|
|
171
|
+
0% {
|
|
172
|
+
visibility: visible;
|
|
173
|
+
opacity: 1;
|
|
174
|
+
}
|
|
175
|
+
100% {
|
|
176
|
+
visibility: hidden;
|
|
177
|
+
opacity: 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -502,7 +502,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
502
502
|
}
|
|
503
503
|
if (actions.import && actions.import.onClick)
|
|
504
504
|
actions.import.onClick(formData, files);
|
|
505
|
-
}, config: { buttons: {
|
|
505
|
+
}, config: { buttons: { okay: "Yükle", cancel: "İptal" } }, windowBlur: true },
|
|
506
506
|
React.createElement(Button, { variant: "outlined", status: "success", icon: { element: React.createElement(ARIcon, { icon: "Import", size: 16 }) }, tooltip: { text: actions.import.tooltip, direction: "top" } }))),
|
|
507
507
|
actions.create && (React.createElement(Button, { variant: "outlined", status: "dark", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 16 }) }, tooltip: { text: actions.create.tooltip, direction: "top" }, onClick: actions.create.onClick }))))))),
|
|
508
508
|
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
|
|
@@ -6,6 +6,7 @@ const Notification = ({ title, message, status, direction = "bottom-left", trigg
|
|
|
6
6
|
const _firstLoad = useRef(false);
|
|
7
7
|
const _notificationItems = useRef([]);
|
|
8
8
|
const [items, setItems] = useState([]);
|
|
9
|
+
// useEffects
|
|
9
10
|
useEffect(() => {
|
|
10
11
|
if (!_firstLoad.current) {
|
|
11
12
|
_firstLoad.current = true;
|
|
@@ -71,11 +71,11 @@ const Popover = ({ children, title, message, content, onConfirm, windowBlur, ful
|
|
|
71
71
|
React.createElement(Button, { status: "success", size: "small", onClick: () => {
|
|
72
72
|
onConfirm(true);
|
|
73
73
|
setOpen(false);
|
|
74
|
-
} }, config?.buttons.
|
|
74
|
+
} }, config?.buttons.okay ?? "Evet"),
|
|
75
75
|
React.createElement(Button, { status: "light", size: "small", onClick: () => {
|
|
76
76
|
onConfirm(false);
|
|
77
77
|
setOpen(false);
|
|
78
|
-
} }, config?.buttons.
|
|
78
|
+
} }, config?.buttons.cancel ?? "Hayır")))), document.body),
|
|
79
79
|
React.createElement("div", { ref: _arPopoverElement, onClick: () => setOpen((prev) => !prev) }, children)));
|
|
80
80
|
};
|
|
81
81
|
export default Popover;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PopupButtonProps, Status } from "../../../libs/core/application/contexts/Notification";
|
|
2
|
+
interface IProps {
|
|
3
|
+
title: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
status: Status | number;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
buttons?: PopupButtonProps | null;
|
|
8
|
+
}
|
|
9
|
+
export default IProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useContext, useEffect, useState } from "react";
|
|
3
|
+
import "../../../assets/css/components/feedback/popup/popup.css";
|
|
4
|
+
import Button from "../../form/button";
|
|
5
|
+
import ReactDOM from "react-dom";
|
|
6
|
+
import { NotificationContext } from "../../../libs/core/application/contexts/Notification";
|
|
7
|
+
const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
8
|
+
const { setIsPopupOpen } = useContext(NotificationContext);
|
|
9
|
+
// states
|
|
10
|
+
const [className, setClassName] = useState(["ar-notification-popup", ""]);
|
|
11
|
+
// useEffects
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setClassName((prev) => {
|
|
14
|
+
const updated = [...prev.slice(0, -1), isOpen ? "open" : ""];
|
|
15
|
+
return updated;
|
|
16
|
+
});
|
|
17
|
+
}, [isOpen]);
|
|
18
|
+
return (isOpen &&
|
|
19
|
+
ReactDOM.createPortal(React.createElement("div", { className: className.map((c) => c).join(" ") },
|
|
20
|
+
React.createElement("div", { className: `icon ${status}` }),
|
|
21
|
+
React.createElement("div", { className: "content" },
|
|
22
|
+
React.createElement("span", { className: `title ${status}` },
|
|
23
|
+
title,
|
|
24
|
+
"!"),
|
|
25
|
+
React.createElement("span", { className: "message" }, message)),
|
|
26
|
+
React.createElement(Button, { variant: "filled", status: status == "success" ? "success" : "danger", onClick: () => {
|
|
27
|
+
(() => buttons?.okay?.onClick && buttons.okay?.onClick())();
|
|
28
|
+
(() => {
|
|
29
|
+
setIsPopupOpen && setIsPopupOpen((prev) => !prev);
|
|
30
|
+
})();
|
|
31
|
+
} }, buttons?.okay?.text ?? "Tamam")), document.body));
|
|
32
|
+
};
|
|
33
|
+
export default Popup;
|
|
@@ -16,8 +16,8 @@ class DATE {
|
|
|
16
16
|
};
|
|
17
17
|
ParseValue = (value, isCloack = false) => {
|
|
18
18
|
const [date, time] = value.split("T");
|
|
19
|
-
const [
|
|
20
|
-
return !isCloack ? date : `${date}T${
|
|
19
|
+
const [hour, minute] = isCloack && time ? time.split(":") : ["00", "00"];
|
|
20
|
+
return !isCloack ? date : `${date}T${hour}:${minute}`;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export default new DATE();
|
|
@@ -5,11 +5,19 @@ type Props = {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
direction: Direction;
|
|
7
7
|
};
|
|
8
|
+
export type PopupButtonProps = {
|
|
9
|
+
okay?: {
|
|
10
|
+
text?: string;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
8
14
|
type NotificationContextProps = {
|
|
9
15
|
setTitle: React.Dispatch<React.SetStateAction<string>>;
|
|
10
16
|
setMessage: React.Dispatch<React.SetStateAction<string>>;
|
|
11
17
|
setStatus: React.Dispatch<React.SetStateAction<Status | number>>;
|
|
12
18
|
setTrigger: React.Dispatch<React.SetStateAction<boolean>>;
|
|
19
|
+
setIsPopupOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
20
|
+
setPopupButtons: React.Dispatch<React.SetStateAction<PopupButtonProps | null>>;
|
|
13
21
|
};
|
|
14
22
|
declare const NotificationContext: React.Context<Partial<NotificationContextProps>>;
|
|
15
23
|
declare const NotificationProvider: ({ children, direction }: Props) => React.JSX.Element;
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { createContext, useState } from "react";
|
|
3
3
|
import Notification from "../../../../components/feedback/notification";
|
|
4
|
+
import Popup from "../../../../components/feedback/popup";
|
|
4
5
|
const NotificationContext = createContext({});
|
|
5
6
|
const NotificationProvider = ({ children, direction }) => {
|
|
6
7
|
const [title, setTitle] = useState("Example");
|
|
7
8
|
const [message, setMessage] = useState("Lorem Ipsum, dizgi ve baskı endüstrisinde kullanılan mıgır metinlerdir.");
|
|
8
9
|
const [status, setStatus] = useState("success");
|
|
9
10
|
const [trigger, setTrigger] = useState(false);
|
|
11
|
+
const [isPopupOpen, setIsPopupOpen] = useState(false);
|
|
12
|
+
const [popupButtons, setPopupButtons] = useState(null);
|
|
10
13
|
return (React.createElement(NotificationContext.Provider, { value: {
|
|
11
14
|
setTitle,
|
|
12
15
|
setMessage,
|
|
13
16
|
setStatus,
|
|
14
17
|
setTrigger,
|
|
18
|
+
setIsPopupOpen,
|
|
19
|
+
setPopupButtons,
|
|
15
20
|
} },
|
|
16
21
|
children,
|
|
17
|
-
React.createElement(Notification, { title: title, message: message, status: status, direction: direction, trigger: trigger })
|
|
22
|
+
React.createElement(Notification, { title: title, message: message, status: status, direction: direction, trigger: trigger }),
|
|
23
|
+
React.createElement(Popup, { title: title, message: message, status: status, isOpen: isPopupOpen, buttons: popupButtons })));
|
|
18
24
|
};
|
|
19
25
|
export { NotificationContext, NotificationProvider };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Status } from "../contexts/Notification";
|
|
1
|
+
import { PopupButtonProps, Status } from "../contexts/Notification";
|
|
2
2
|
import { ValidationProperties } from "../../../types";
|
|
3
3
|
import { INotificationLocale } from "../locales";
|
|
4
4
|
export declare const useLayout: () => {
|
|
@@ -50,6 +50,12 @@ export declare const useNotification: () => {
|
|
|
50
50
|
message?: string;
|
|
51
51
|
status: Status | number;
|
|
52
52
|
}) => void;
|
|
53
|
+
popup: ({ title, message, status, buttons, }: {
|
|
54
|
+
title: string;
|
|
55
|
+
message?: string;
|
|
56
|
+
status: Status | number;
|
|
57
|
+
buttons?: PopupButtonProps | null;
|
|
58
|
+
}) => void;
|
|
53
59
|
};
|
|
54
60
|
export declare const useValidation: <TData extends object>(data: TData, params: ValidationProperties<TData>[], step?: number) => {
|
|
55
61
|
onSubmit: (callback: (result: boolean) => void) => void;
|
|
@@ -25,7 +25,7 @@ export const useTranslation = function (currentLanguage, translations) {
|
|
|
25
25
|
};
|
|
26
26
|
export const useNotification = () => {
|
|
27
27
|
// contexts
|
|
28
|
-
const { setTitle, setMessage, setStatus, setTrigger } = useContext(NotificationContext);
|
|
28
|
+
const { setTitle, setMessage, setStatus, setTrigger, setIsPopupOpen, setPopupButtons } = useContext(NotificationContext);
|
|
29
29
|
// methods
|
|
30
30
|
const notification = ({ title, message, status }) => {
|
|
31
31
|
setTitle && setTitle(title);
|
|
@@ -33,7 +33,14 @@ export const useNotification = () => {
|
|
|
33
33
|
setStatus && setStatus(status);
|
|
34
34
|
setTrigger && setTrigger((trigger) => !trigger);
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
const popup = ({ title, message, status, buttons, }) => {
|
|
37
|
+
setTitle && setTitle(title);
|
|
38
|
+
setMessage && setMessage(message ?? "");
|
|
39
|
+
setStatus && setStatus(status);
|
|
40
|
+
setIsPopupOpen && setIsPopupOpen((trigger) => !trigger);
|
|
41
|
+
setPopupButtons && setPopupButtons(buttons ?? null);
|
|
42
|
+
};
|
|
43
|
+
return { notification, popup };
|
|
37
44
|
};
|
|
38
45
|
export const useValidation = function (data, params, step) {
|
|
39
46
|
// refs
|