ar-design 0.3.39 → 0.3.41
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 → popup-confirm/styles.css} +27 -28
- package/dist/components/feedback/popup-confirm/IProps.d.ts +10 -0
- package/dist/components/feedback/popup-confirm/index.d.ts +5 -0
- package/dist/components/feedback/{popup → popup-confirm}/index.js +31 -25
- package/dist/components/icons/Compiler.js +6 -0
- package/dist/components/navigation/steps/IProps.d.ts +1 -0
- package/dist/components/navigation/steps/index.d.ts +1 -1
- package/dist/components/navigation/steps/index.js +18 -16
- package/dist/libs/core/application/contexts/Notification.d.ts +7 -10
- package/dist/libs/core/application/contexts/Notification.js +6 -2
- package/dist/libs/core/application/hooks/index.d.ts +6 -4
- package/dist/libs/core/application/hooks/index.js +13 -12
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/feedback/popup/IProps.d.ts +0 -9
- package/dist/components/feedback/popup/index.d.ts +0 -5
- /package/dist/components/feedback/{popup → popup-confirm}/IProps.js +0 -0
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
gap: 1.5rem;
|
|
25
25
|
background-color: var(--white);
|
|
26
26
|
width: 450px;
|
|
27
|
-
padding:
|
|
27
|
+
padding: 2rem;
|
|
28
28
|
border-radius: var(--border-radius-sm);
|
|
29
29
|
box-shadow: 0 5px 15px -5px rgba(var(--black-rgb), 0.25);
|
|
30
30
|
overflow: hidden;
|
|
@@ -38,38 +38,32 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.ar-notification-popup > .icon {
|
|
41
|
-
width: 5rem;
|
|
42
|
-
height: 5rem;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.ar-notification-popup > .icon.success {
|
|
46
41
|
position: relative;
|
|
47
42
|
display: flex;
|
|
48
43
|
justify-content: center;
|
|
49
44
|
align-items: center;
|
|
50
|
-
|
|
45
|
+
width: 3rem;
|
|
46
|
+
height: 3rem;
|
|
51
47
|
border-radius: var(--border-radius-pill);
|
|
52
|
-
box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.25);
|
|
53
|
-
}
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
&.success,
|
|
50
|
+
&.save {
|
|
51
|
+
background-color: rgba(var(--success-rgb), 0.25);
|
|
52
|
+
box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.1);
|
|
53
|
+
}
|
|
54
|
+
&.warning {
|
|
55
|
+
background-color: rgba(var(--warning-rgb), 0.25);
|
|
56
|
+
box-shadow: 0 0 0 5px rgba(var(--warning-rgb), 0.1);
|
|
57
|
+
}
|
|
58
|
+
&.information {
|
|
59
|
+
background-color: rgba(var(--information-rgb), 0.25);
|
|
60
|
+
box-shadow: 0 0 0 5px rgba(var(--information-rgb), 0.1);
|
|
61
|
+
}
|
|
62
|
+
&.error,
|
|
63
|
+
&.delete {
|
|
64
|
+
background-color: rgba(var(--danger-rgb), 0.25);
|
|
65
|
+
box-shadow: 0 0 0 5px rgba(var(--danger-rgb), 0.1);
|
|
66
|
+
}
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
.ar-notification-popup > .content {
|
|
@@ -83,7 +77,8 @@
|
|
|
83
77
|
}
|
|
84
78
|
.ar-notification-popup > .content > .title {
|
|
85
79
|
color: var(--gray-700);
|
|
86
|
-
font-size: 1.
|
|
80
|
+
font-size: 1.25rem;
|
|
81
|
+
font-weight: 700;
|
|
87
82
|
text-align: center;
|
|
88
83
|
}
|
|
89
84
|
|
|
@@ -92,6 +87,10 @@
|
|
|
92
87
|
text-align: center;
|
|
93
88
|
}
|
|
94
89
|
|
|
90
|
+
.ar-notification-popup > .footer {
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
95
94
|
@media only screen and (max-width: 480px) {
|
|
96
95
|
.ar-notification.top-left {
|
|
97
96
|
inset: 1rem 1rem auto 1rem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PopupButtonConfig, Status } from "../../../libs/core/application/contexts/Notification";
|
|
2
|
+
interface IProps {
|
|
3
|
+
title: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
status: (Status | "save" | "delete") | number;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
buttons?: PopupButtonConfig | null;
|
|
8
|
+
onConfirm?: ((confirm: boolean) => void) | null;
|
|
9
|
+
}
|
|
10
|
+
export default IProps;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import IProps from "./IProps";
|
|
3
|
+
import "../../../assets/css/components/feedback/popup-confirm/styles.css";
|
|
4
|
+
declare const PopupConfirm: ({ title, message, status, isOpen, buttons, onConfirm }: IProps) => false | React.ReactPortal;
|
|
5
|
+
export default PopupConfirm;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
3
|
-
import "../../../assets/css/components/feedback/popup/
|
|
3
|
+
import "../../../assets/css/components/feedback/popup-confirm/styles.css";
|
|
4
4
|
import Button from "../../form/button";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
6
|
import { NotificationContext } from "../../../libs/core/application/contexts/Notification";
|
|
7
7
|
import { ARIcon } from "../../icons";
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import Row from "../../data-display/grid-system/row/Row";
|
|
9
|
+
import Column from "../../data-display/grid-system/column/Column";
|
|
10
|
+
const PopupConfirm = ({ title, message, status, isOpen, buttons, onConfirm }) => {
|
|
10
11
|
// contexts
|
|
11
12
|
const { setIsPopupOpen } = useContext(NotificationContext);
|
|
12
13
|
// refs
|
|
@@ -19,12 +20,14 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
|
19
20
|
const buttonColor = () => {
|
|
20
21
|
switch (status) {
|
|
21
22
|
case "success":
|
|
23
|
+
case "save":
|
|
22
24
|
return "green";
|
|
23
25
|
case "warning":
|
|
24
26
|
return "orange";
|
|
25
27
|
case "information":
|
|
26
|
-
return "
|
|
28
|
+
return "cyan";
|
|
27
29
|
case "error":
|
|
30
|
+
case "delete":
|
|
28
31
|
return "red";
|
|
29
32
|
default:
|
|
30
33
|
return "light";
|
|
@@ -33,13 +36,17 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
|
33
36
|
const buttonIcons = () => {
|
|
34
37
|
switch (status) {
|
|
35
38
|
case "success":
|
|
36
|
-
return React.createElement(ARIcon, { icon: "CheckAll", fill: "var(--
|
|
39
|
+
return React.createElement(ARIcon, { icon: "CheckAll", fill: "var(--success)", size: 24 });
|
|
40
|
+
case "save":
|
|
41
|
+
return React.createElement(ARIcon, { icon: "Floppy-Fill", fill: "var(--success)", size: 24 });
|
|
37
42
|
case "warning":
|
|
38
|
-
return React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--
|
|
43
|
+
return React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--warning)", size: 24 });
|
|
39
44
|
case "information":
|
|
40
|
-
return "information";
|
|
45
|
+
return React.createElement(ARIcon, { icon: "Information-Circle-Fill", fill: "var(--information)", size: 24 });
|
|
41
46
|
case "error":
|
|
42
|
-
return React.createElement(ARIcon, { icon: "XCircle-Fill", fill: "var(--
|
|
47
|
+
return React.createElement(ARIcon, { icon: "XCircle-Fill", fill: "var(--danger)", size: 24 });
|
|
48
|
+
case "delete":
|
|
49
|
+
return React.createElement(ARIcon, { icon: "Trash-Fill", fill: "var(--danger)", size: 24 });
|
|
43
50
|
default:
|
|
44
51
|
return "light";
|
|
45
52
|
}
|
|
@@ -71,22 +78,21 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
|
|
|
71
78
|
React.createElement("div", { ref: _arNotificationPopup, className: className.map((c) => c).join(" ") },
|
|
72
79
|
React.createElement("div", { className: `icon ${status}` }, buttonIcons()),
|
|
73
80
|
React.createElement("div", { className: "content" },
|
|
74
|
-
React.createElement("span", { className: `title ${status}` },
|
|
75
|
-
title,
|
|
76
|
-
"!"),
|
|
81
|
+
React.createElement("span", { className: `title ${status}` }, title),
|
|
77
82
|
React.createElement("span", { className: "message" }, message)),
|
|
78
|
-
React.createElement(
|
|
79
|
-
React.createElement(
|
|
80
|
-
|
|
81
|
-
(() => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(() => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
React.createElement("div", { className: "footer" },
|
|
84
|
+
React.createElement(Row, null,
|
|
85
|
+
React.createElement(Column, { size: buttons?.cancel ? 6 : 12 },
|
|
86
|
+
React.createElement(Button, { color: buttonColor(), onClick: (event) => {
|
|
87
|
+
buttons?.okay?.onClick?.(event);
|
|
88
|
+
onConfirm?.(true);
|
|
89
|
+
setIsPopupOpen?.((prev) => !prev);
|
|
90
|
+
}, fullWidth: true }, buttons?.okay?.children ?? "Tamam")),
|
|
91
|
+
buttons?.cancel && (React.createElement(Column, { size: 6 },
|
|
92
|
+
React.createElement(Button, { variant: "outlined", color: buttons.cancel.color ?? "gray", onClick: (event) => {
|
|
93
|
+
buttons?.cancel?.onClick?.(event);
|
|
94
|
+
onConfirm?.(false);
|
|
95
|
+
setIsPopupOpen?.((prev) => !prev);
|
|
96
|
+
}, fullWidth: true }, buttons.cancel.children ?? "Vazgeç"))))))), document.body));
|
|
91
97
|
};
|
|
92
|
-
export default
|
|
98
|
+
export default PopupConfirm;
|
|
@@ -82,6 +82,10 @@ class Icon {
|
|
|
82
82
|
case "Filter":
|
|
83
83
|
return (React.createElement(React.Fragment, null,
|
|
84
84
|
React.createElement("path", { d: "M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5" })));
|
|
85
|
+
case "Floppy-Fill":
|
|
86
|
+
return (React.createElement(React.Fragment, null,
|
|
87
|
+
React.createElement("path", { d: "M0 1.5A1.5 1.5 0 0 1 1.5 0H3v5.5A1.5 1.5 0 0 0 4.5 7h7A1.5 1.5 0 0 0 13 5.5V0h.086a1.5 1.5 0 0 1 1.06.44l1.415 1.414A1.5 1.5 0 0 1 16 2.914V14.5a1.5 1.5 0 0 1-1.5 1.5H14v-5.5A1.5 1.5 0 0 0 12.5 9h-9A1.5 1.5 0 0 0 2 10.5V16h-.5A1.5 1.5 0 0 1 0 14.5z" }),
|
|
88
|
+
React.createElement("path", { d: "M3 16h10v-5.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5zm9-16H4v5.5a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5zM9 1h2v4H9z" })));
|
|
85
89
|
case "Front":
|
|
86
90
|
return (React.createElement("path", { d: "M0 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2H2a2 2 0 0 1-2-2zm5 10v2a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2v5a2 2 0 0 1-2 2z" }));
|
|
87
91
|
case "GripVertical":
|
|
@@ -92,6 +96,8 @@ class Icon {
|
|
|
92
96
|
React.createElement("path", { d: "M12 3V16M12 16L16 11.625M12 16L8 11.625", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
93
97
|
case "Inbox-Fill":
|
|
94
98
|
return (React.createElement("path", { d: "M4.98 4a.5.5 0 0 0-.39.188L1.54 8H6a.5.5 0 0 1 .5.5 1.5 1.5 0 1 0 3 0A.5.5 0 0 1 10 8h4.46l-3.05-3.812A.5.5 0 0 0 11.02 4zm-1.17-.437A1.5 1.5 0 0 1 4.98 3h6.04a1.5 1.5 0 0 1 1.17.563l3.7 4.625a.5.5 0 0 1 .106.374l-.39 3.124A1.5 1.5 0 0 1 14.117 13H1.883a1.5 1.5 0 0 1-1.489-1.314l-.39-3.124a.5.5 0 0 1 .106-.374z" }));
|
|
99
|
+
case "Information-Circle-Fill":
|
|
100
|
+
return (React.createElement("path", { d: "M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2" }));
|
|
95
101
|
case "Italic":
|
|
96
102
|
return (React.createElement("path", { d: "M7.991 11.674 9.53 4.455c.123-.595.246-.71 1.347-.807l.11-.52H7.211l-.11.52c1.06.096 1.128.212 1.005.807L6.57 11.674c-.123.595-.246.71-1.346.806l-.11.52h3.774l.11-.52c-1.06-.095-1.129-.211-1.006-.806z" }));
|
|
97
103
|
case "NumberList":
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StepProps, ValidationProperties } from "../../../libs/types";
|
|
2
2
|
import { IChildren } from "../../../libs/types/IGlobalProps";
|
|
3
3
|
interface IProps<TData extends object> extends IChildren {
|
|
4
|
+
name: string;
|
|
4
5
|
steps: StepProps[];
|
|
5
6
|
onChange: (currentStep: number) => void;
|
|
6
7
|
validation?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import IProps from "./IProps";
|
|
3
3
|
import "../../../assets/css/components/navigation/steps/styles.css";
|
|
4
|
-
declare const Steps: <T extends object>({ children, steps, onChange, validation }: IProps<T>) => React.JSX.Element;
|
|
4
|
+
declare const Steps: <T extends object>({ children, name, steps, onChange, validation }: IProps<T>) => React.JSX.Element;
|
|
5
5
|
export default Steps;
|
|
@@ -5,18 +5,11 @@ import Typography from "../../data-display/typography";
|
|
|
5
5
|
import Button from "../../form/button";
|
|
6
6
|
import { useValidation } from "../../../libs/core/application/hooks";
|
|
7
7
|
const { Title } = Typography;
|
|
8
|
-
const Steps = function ({ children, steps = [], onChange, validation }) {
|
|
8
|
+
const Steps = function ({ children, name, steps = [], onChange, validation }) {
|
|
9
9
|
// states
|
|
10
10
|
const [currentStep, setCurrentStep] = useState(0);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let _setSubmit;
|
|
14
|
-
if (validation) {
|
|
15
|
-
const { errors, onSubmit, setSubmit } = useValidation(validation.data, validation.rules, currentStep + 1);
|
|
16
|
-
_errors = errors;
|
|
17
|
-
_onSubmit = onSubmit;
|
|
18
|
-
_setSubmit = setSubmit;
|
|
19
|
-
}
|
|
11
|
+
// hooks
|
|
12
|
+
const { errors, onSubmit, setSubmit } = useValidation(validation?.data, validation?.rules, currentStep + 1);
|
|
20
13
|
// methods
|
|
21
14
|
const getStepIconStatus = (currentStep, index) => {
|
|
22
15
|
if (currentStep < index)
|
|
@@ -26,7 +19,12 @@ const Steps = function ({ children, steps = [], onChange, validation }) {
|
|
|
26
19
|
return "completed";
|
|
27
20
|
};
|
|
28
21
|
// useEffects
|
|
29
|
-
useEffect(() =>
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const key = `${window.location.pathname}::${name}`;
|
|
24
|
+
const stored = sessionStorage.getItem(key);
|
|
25
|
+
setCurrentStep(stored !== null ? Number(stored) : 0);
|
|
26
|
+
onChange?.(stored !== null ? Number(stored) : 0);
|
|
27
|
+
}, []);
|
|
30
28
|
return (React.createElement("div", { className: "ar-steps" },
|
|
31
29
|
React.createElement("div", { className: "steps" }, steps.length > 0 &&
|
|
32
30
|
steps.map((step, index) => {
|
|
@@ -34,18 +32,20 @@ const Steps = function ({ children, steps = [], onChange, validation }) {
|
|
|
34
32
|
itemIcon.push(getStepIconStatus(currentStep, index));
|
|
35
33
|
return (React.createElement("div", { key: step.title || index, className: "item", onClick: () => {
|
|
36
34
|
if (validation) {
|
|
37
|
-
|
|
35
|
+
onSubmit((result) => {
|
|
38
36
|
if (!result)
|
|
39
37
|
return;
|
|
40
38
|
setCurrentStep(index);
|
|
41
39
|
onChange(index);
|
|
42
|
-
|
|
40
|
+
setSubmit(false);
|
|
43
41
|
});
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
44
|
setCurrentStep(index);
|
|
47
45
|
onChange(index);
|
|
48
46
|
}
|
|
47
|
+
const key = `${window.location.pathname}::${name}`;
|
|
48
|
+
sessionStorage.setItem(key, String(index));
|
|
49
49
|
} },
|
|
50
50
|
React.createElement("div", { className: itemIcon.map((c) => c).join(" ") },
|
|
51
51
|
React.createElement("span", { className: getStepIconStatus(currentStep, index) })),
|
|
@@ -61,7 +61,7 @@ const Steps = function ({ children, steps = [], onChange, validation }) {
|
|
|
61
61
|
if (React.isValidElement(child) && stepIndex === currentStep) {
|
|
62
62
|
return validation
|
|
63
63
|
? React.cloneElement(child, {
|
|
64
|
-
errors:
|
|
64
|
+
errors: errors,
|
|
65
65
|
})
|
|
66
66
|
: child;
|
|
67
67
|
}
|
|
@@ -76,18 +76,20 @@ const Steps = function ({ children, steps = [], onChange, validation }) {
|
|
|
76
76
|
children && children,
|
|
77
77
|
currentStep < steps.length - 1 && (React.createElement(Button, { color: "blue", onClick: () => {
|
|
78
78
|
if (validation) {
|
|
79
|
-
|
|
79
|
+
onSubmit((result) => {
|
|
80
80
|
if (!result)
|
|
81
81
|
return;
|
|
82
82
|
setCurrentStep((prev) => prev + 1);
|
|
83
83
|
onChange(currentStep + 1);
|
|
84
|
-
|
|
84
|
+
setSubmit(false);
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
setCurrentStep((prev) => prev + 1);
|
|
89
89
|
onChange(currentStep + 1);
|
|
90
90
|
}
|
|
91
|
+
const key = `${window.location.pathname}::${name}`;
|
|
92
|
+
sessionStorage.setItem(key, String(currentStep + 1));
|
|
91
93
|
} }, "\u0130leri"))))));
|
|
92
94
|
};
|
|
93
95
|
export default Steps;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import IButtonProps from "../../../../components/form/button/IProps";
|
|
2
3
|
export type Status = "success" | "warning" | "information" | "error";
|
|
3
4
|
export type Direction = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
4
5
|
type Props = {
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
direction: Direction;
|
|
7
8
|
};
|
|
8
|
-
export type
|
|
9
|
-
okay?:
|
|
10
|
-
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
};
|
|
13
|
-
cancel?: {
|
|
14
|
-
text?: string;
|
|
15
|
-
onClick?: () => void;
|
|
16
|
-
};
|
|
9
|
+
export type PopupButtonConfig = {
|
|
10
|
+
okay?: IButtonProps;
|
|
11
|
+
cancel?: IButtonProps;
|
|
17
12
|
};
|
|
18
13
|
type NotificationContextProps = {
|
|
19
14
|
setTitle: React.Dispatch<React.SetStateAction<string>>;
|
|
20
15
|
setMessage: React.Dispatch<React.SetStateAction<string>>;
|
|
21
16
|
setStatus: React.Dispatch<React.SetStateAction<Status | number>>;
|
|
17
|
+
setPopupStatus: React.Dispatch<React.SetStateAction<(Status | "save" | "delete") | number>>;
|
|
22
18
|
setTrigger: React.Dispatch<React.SetStateAction<boolean>>;
|
|
23
19
|
setIsPopupOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
24
|
-
setPopupButtons: React.Dispatch<React.SetStateAction<
|
|
20
|
+
setPopupButtons: React.Dispatch<React.SetStateAction<PopupButtonConfig | null>>;
|
|
21
|
+
setOnConfirm: React.Dispatch<React.SetStateAction<((confirm: boolean) => void) | null>>;
|
|
25
22
|
};
|
|
26
23
|
declare const NotificationContext: React.Context<Partial<NotificationContextProps>>;
|
|
27
24
|
declare const NotificationProvider: ({ children, direction }: Props) => React.JSX.Element;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { createContext, useState } from "react";
|
|
3
3
|
import Notification from "../../../../components/feedback/notification";
|
|
4
|
-
import
|
|
4
|
+
import PopupConfirm from "../../../../components/feedback/popup-confirm";
|
|
5
5
|
const NotificationContext = createContext({});
|
|
6
6
|
const NotificationProvider = ({ children, direction }) => {
|
|
7
7
|
const [title, setTitle] = useState("Example");
|
|
8
8
|
const [message, setMessage] = useState("Lorem Ipsum, dizgi ve baskı endüstrisinde kullanılan mıgır metinlerdir.");
|
|
9
9
|
const [status, setStatus] = useState("success");
|
|
10
|
+
const [popupStatus, setPopupStatus] = useState("success");
|
|
10
11
|
const [trigger, setTrigger] = useState(false);
|
|
11
12
|
const [isPopupOpen, setIsPopupOpen] = useState(false);
|
|
12
13
|
const [popupButtons, setPopupButtons] = useState(null);
|
|
14
|
+
const [onConfirm, setOnConfirm] = useState(null);
|
|
13
15
|
return (React.createElement(NotificationContext.Provider, { value: {
|
|
14
16
|
setTitle,
|
|
15
17
|
setMessage,
|
|
16
18
|
setStatus,
|
|
19
|
+
setPopupStatus,
|
|
17
20
|
setTrigger,
|
|
18
21
|
setIsPopupOpen,
|
|
19
22
|
setPopupButtons,
|
|
23
|
+
setOnConfirm,
|
|
20
24
|
} },
|
|
21
25
|
children,
|
|
22
26
|
React.createElement(Notification, { title: title, message: message, status: status, direction: direction, trigger: trigger }),
|
|
23
|
-
React.createElement(
|
|
27
|
+
React.createElement(PopupConfirm, { title: title, message: message, status: popupStatus, isOpen: isPopupOpen, buttons: popupButtons, onConfirm: onConfirm })));
|
|
24
28
|
};
|
|
25
29
|
export { NotificationContext, NotificationProvider };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PopupButtonConfig, Status } from "../contexts/Notification";
|
|
2
2
|
import { ValidationProperties } from "../../../types";
|
|
3
3
|
import { INotificationLocale } from "../locales";
|
|
4
4
|
export declare const useLayout: () => {
|
|
@@ -50,11 +50,13 @@ export declare const useNotification: () => {
|
|
|
50
50
|
message?: string;
|
|
51
51
|
status: Status | number;
|
|
52
52
|
}) => void;
|
|
53
|
-
|
|
53
|
+
popupConfirm: ({ title, message, status, buttons, onConfirm, }: {
|
|
54
54
|
title: string;
|
|
55
55
|
message?: string;
|
|
56
|
-
status: Status | number;
|
|
57
|
-
|
|
56
|
+
status: (Status | "save" | "delete") | number;
|
|
57
|
+
buttons?: PopupButtonConfig | null;
|
|
58
|
+
onConfirm?: (confirm: boolean) => void;
|
|
59
|
+
}) => void;
|
|
58
60
|
};
|
|
59
61
|
export declare const useValidation: <TData extends object>(data: TData, params: ValidationProperties<TData>[], step?: number) => {
|
|
60
62
|
onSubmit: (callback: (result: boolean) => void) => void;
|
|
@@ -26,22 +26,23 @@ export const useTranslation = function (currentLanguage, translations) {
|
|
|
26
26
|
};
|
|
27
27
|
export const useNotification = () => {
|
|
28
28
|
// contexts
|
|
29
|
-
const { setTitle, setMessage, setStatus, setTrigger, setIsPopupOpen, setPopupButtons } = useContext(NotificationContext);
|
|
29
|
+
const { setTitle, setMessage, setStatus, setPopupStatus, setTrigger, setIsPopupOpen, setPopupButtons, setOnConfirm } = useContext(NotificationContext);
|
|
30
30
|
// methods
|
|
31
31
|
const notification = ({ title, message, status }) => {
|
|
32
|
-
setTitle
|
|
33
|
-
setMessage
|
|
34
|
-
setStatus
|
|
35
|
-
setTrigger
|
|
32
|
+
setTitle?.(title);
|
|
33
|
+
setMessage?.(message ?? "");
|
|
34
|
+
setStatus?.(status);
|
|
35
|
+
setTrigger?.((trigger) => !trigger);
|
|
36
36
|
};
|
|
37
|
-
const
|
|
38
|
-
setTitle
|
|
39
|
-
setMessage
|
|
40
|
-
|
|
41
|
-
setIsPopupOpen
|
|
42
|
-
setPopupButtons
|
|
37
|
+
const popupConfirm = ({ title, message, status, buttons, onConfirm, }) => {
|
|
38
|
+
setTitle?.(title);
|
|
39
|
+
setMessage?.(message ?? "");
|
|
40
|
+
setPopupStatus?.(status);
|
|
41
|
+
setIsPopupOpen?.((trigger) => !trigger);
|
|
42
|
+
setPopupButtons?.(buttons ?? null);
|
|
43
|
+
setOnConfirm?.(() => onConfirm);
|
|
43
44
|
};
|
|
44
|
-
return { notification,
|
|
45
|
+
return { notification, popupConfirm };
|
|
45
46
|
};
|
|
46
47
|
export const useValidation = function (data, params, step) {
|
|
47
48
|
// refs
|
|
@@ -83,7 +83,7 @@ export type Errors<TData> = Partial<{
|
|
|
83
83
|
}>;
|
|
84
84
|
export type MimeTypes = "image/jpeg" | "image/png" | "image/gif" | "image/webp" | "image/svg+xml" | "image/bmp" | "image/tiff" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/x-rar-compressed" | "application/x-7z-compressed" | "application/gzip" | "application/json" | "application/xml" | "text/plain" | "text/csv" | "text/html" | "video/mp4" | "video/quicktime" | "video/x-msvideo" | "video/x-matroska" | "video/webm" | "video/x-flv" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/aac" | "audio/flac" | "application/octet-stream";
|
|
85
85
|
export type FileCategory = "image" | "document" | "spreadsheet" | "presentation" | "archive" | "text" | "video" | "audio" | "json" | "xml" | "binary" | "other";
|
|
86
|
-
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "Bold" | "BulletList" | "CameraReels" | "CheckAll" | "CloseCircle" | "CloseSquare" | "CloudUpload-Fill" | "Dash" | "Document" | "Download" | "ExclamationCircle" | "ExclamationDiamond-Fill" | "Eye-Fill" | "File" | "FileEarmark-Fill" | "FileTypeCsv" | "FileTypeDoc" | "FileTypeDocx" | "FileTypeHtml" | "FileTypeJson" | "FileTypePdf" | "FileTypePptx" | "FileTypeTxt" | "FileTypeXls" | "FileTypeXlsx" | "FileTypeXml" | "FileTypeZip" | "Filter" | "Folder" | "Front" | "GripVertical" | "Import" | "Inbox-Fill" | "Italic" | "NumberList" | "Strikethrough" | "TextAlingCenter" | "TextAlingLeft" | "TextAlingRight" | "TickCircle" | "Trash-Fill" | "Underline" | "Upload" | "Warning" | "XCircle-Fill";
|
|
86
|
+
export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "Bold" | "BulletList" | "CameraReels" | "CheckAll" | "CloseCircle" | "CloseSquare" | "CloudUpload-Fill" | "Dash" | "Document" | "Download" | "ExclamationCircle" | "ExclamationDiamond-Fill" | "Eye-Fill" | "File" | "FileEarmark-Fill" | "FileTypeCsv" | "FileTypeDoc" | "FileTypeDocx" | "FileTypeHtml" | "FileTypeJson" | "FileTypePdf" | "FileTypePptx" | "FileTypeTxt" | "FileTypeXls" | "FileTypeXlsx" | "FileTypeXml" | "FileTypeZip" | "Filter" | "Floppy-Fill" | "Folder" | "Front" | "GripVertical" | "Import" | "Inbox-Fill" | "Information-Circle-Fill" | "Italic" | "NumberList" | "Strikethrough" | "TextAlingCenter" | "TextAlingLeft" | "TextAlingRight" | "TickCircle" | "Trash-Fill" | "Underline" | "Upload" | "Warning" | "XCircle-Fill";
|
|
87
87
|
export type PieChartDataType = {
|
|
88
88
|
value: number;
|
|
89
89
|
text: string;
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
File without changes
|