ar-design 0.2.67 → 0.2.68

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.
@@ -50,15 +50,15 @@
50
50
  border-radius: var(--border-radius-pill);
51
51
  box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.25);
52
52
  }
53
- .ar-notification-popup > .icon.success::before {
54
- content: "";
55
- width: 3rem;
56
- height: 1.75rem;
57
- transform: rotate(-45deg);
58
- border: solid 10.5px transparent;
59
- border-radius: var(--border-radius-sm);
60
- border-left-color: var(--white);
61
- border-bottom-color: var(--white);
53
+
54
+ .ar-notification-popup > .icon.warning {
55
+ position: relative;
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ background-color: var(--warning);
60
+ border-radius: var(--border-radius-pill);
61
+ box-shadow: 0 0 0 5px rgba(var(--warning-rgb), 0.25);
62
62
  }
63
63
 
64
64
  .ar-notification-popup > .icon.error {
@@ -70,24 +70,6 @@
70
70
  border-radius: var(--border-radius-pill);
71
71
  box-shadow: 0 0 0 5px rgba(var(--danger-rgb), 0.25);
72
72
  }
73
- .ar-notification-popup > .icon.error::before {
74
- position: absolute;
75
- content: "";
76
- background-color: var(--white);
77
- width: 10.5px;
78
- height: 3.5rem;
79
- transform: rotate(-45deg);
80
- border-radius: var(--border-radius-sm);
81
- }
82
- .ar-notification-popup > .icon.error::after {
83
- position: absolute;
84
- content: "";
85
- background-color: var(--white);
86
- width: 10.5px;
87
- height: 3.5rem;
88
- transform: rotate(45deg);
89
- border-radius: var(--border-radius-sm);
90
- }
91
73
 
92
74
  .ar-notification-popup > .content {
93
75
  display: flex;
@@ -99,17 +81,11 @@
99
81
  color: var(--gray-700);
100
82
  }
101
83
  .ar-notification-popup > .content > .title {
84
+ color: var(--gray-700);
102
85
  font-size: 1.75rem;
103
86
  text-align: center;
104
87
  }
105
88
 
106
- .ar-notification-popup > .content > .title.success {
107
- color: var(--success);
108
- }
109
- .ar-notification-popup > .content > .title.error {
110
- color: var(--danger);
111
- }
112
-
113
89
  .ar-notification-popup > .content > .message {
114
90
  color: var(--gray-600);
115
91
  text-align: center;
@@ -4,6 +4,7 @@ import "../../../assets/css/components/feedback/popup/popup.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
+ import { ARIcon } from "../../icons";
7
8
  const Popup = ({ title, message, status, isOpen, buttons }) => {
8
9
  // contexts
9
10
  const { setIsPopupOpen } = useContext(NotificationContext);
@@ -13,6 +14,35 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
13
14
  // states
14
15
  const _notificaitonPopupWrapperClassName = ["ar-notification-popup-wrapper"];
15
16
  const [className, setClassName] = useState(["ar-notification-popup", ""]);
17
+ // methods
18
+ const buttonStatus = () => {
19
+ switch (status) {
20
+ case "success":
21
+ return "success";
22
+ case "warning":
23
+ return "warning";
24
+ case "information":
25
+ return "information";
26
+ case "error":
27
+ return "danger";
28
+ default:
29
+ return "light";
30
+ }
31
+ };
32
+ const buttonIcons = () => {
33
+ switch (status) {
34
+ case "success":
35
+ return React.createElement(ARIcon, { icon: "Success", fill: "transparent", stroke: "var(--white)", size: 48 });
36
+ case "warning":
37
+ return React.createElement(ARIcon, { icon: "Warning", fill: "transparent", stroke: "var(--white)", size: 48 });
38
+ case "information":
39
+ return "information";
40
+ case "error":
41
+ return React.createElement(ARIcon, { icon: "CloseCircle", fill: "transparent", stroke: "var(--white)", size: 48 });
42
+ default:
43
+ return "light";
44
+ }
45
+ };
16
46
  // useEffects
17
47
  useEffect(() => {
18
48
  setClassName((prev) => {
@@ -38,13 +68,13 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
38
68
  }
39
69
  } }),
40
70
  React.createElement("div", { ref: _arNotificationPopup, className: className.map((c) => c).join(" ") },
41
- React.createElement("div", { className: `icon ${status}` }),
71
+ React.createElement("div", { className: `icon ${status}` }, buttonIcons()),
42
72
  React.createElement("div", { className: "content" },
43
73
  React.createElement("span", { className: `title ${status}` },
44
74
  title,
45
75
  "!"),
46
76
  React.createElement("span", { className: "message" }, message)),
47
- React.createElement(Button, { variant: "filled", status: status == "success" ? "success" : "danger", onClick: () => {
77
+ React.createElement(Button, { variant: "filled", status: buttonStatus(), onClick: () => {
48
78
  (() => buttons?.okay?.onClick && buttons.okay?.onClick())();
49
79
  (() => {
50
80
  setIsPopupOpen && setIsPopupOpen((prev) => !prev);
@@ -29,8 +29,8 @@ validation, }) => {
29
29
  // variables
30
30
  const toolbarButtons = [
31
31
  { command: "bold", icon: "Bold", tooltip: `Bold (${Utils.GetOSShortCutIcons()} + B)` },
32
- { command: "italic", icon: "Italic", tooltip: `Bold (${Utils.GetOSShortCutIcons()} + I)` },
33
- { command: "underline", icon: "Underline", tooltip: `Bold (${Utils.GetOSShortCutIcons()} + U)` },
32
+ { command: "italic", icon: "Italic", tooltip: `Italic (${Utils.GetOSShortCutIcons()} + I)` },
33
+ { command: "underline", icon: "Underline", tooltip: `Underline (${Utils.GetOSShortCutIcons()} + U)` },
34
34
  { command: "insertUnorderedList", icon: "BulletList", tooltip: "Bulleted List" },
35
35
  { command: "insertOrderedList", icon: "NumberList", tooltip: "Numbered List" },
36
36
  { command: "justifyLeft", icon: "TextAlingLeft", tooltip: "Align Left" },
@@ -212,7 +212,7 @@ validation, }) => {
212
212
  }, []);
213
213
  return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
214
214
  React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height }),
215
- React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "var(--gray-700)" }) }, tooltip: {
215
+ React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "transparent" }) }, tooltip: {
216
216
  text: tooltip,
217
217
  }, onClick: () => execCommand(command) })))),
218
218
  React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
@@ -53,6 +53,11 @@ class Icon {
53
53
  React.createElement("line", { x1: "4", y1: "12", x2: "20", y2: "12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
54
54
  React.createElement("path", { d: "M6 4h12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
55
55
  React.createElement("path", { d: "M6 20h12", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
56
+ case "Success":
57
+ return (React.createElement(React.Fragment, null,
58
+ React.createElement("path", { d: "M22 11.1V6.9C22 3.4 20.6 2 17.1 2h-4.2C9.4 2 8 3.4 8 6.9V8h3.1c3.5 0 4.9 1.4 4.9 4.9V16h1.1c3.5 0 4.9-1.4 4.9-4.9z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
59
+ React.createElement("path", { d: "M16 17.1v-4.2C16 9.4 14.6 8 11.1 8H6.9C3.4 8 2 9.4 2 12.9v4.2C2 20.6 3.4 22 6.9 22h4.2c3.5 0 4.9-1.4 4.9-4.9z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
60
+ React.createElement("path", { d: "M6.08 15l1.95 1.95 3.89-3.9", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
56
61
  case "BulletList":
57
62
  return (React.createElement(React.Fragment, null,
58
63
  React.createElement("circle", { cx: 3, cy: this._startIndex, r: 2, fill: "currentColor" }),
@@ -91,6 +96,10 @@ class Icon {
91
96
  return (React.createElement(React.Fragment, null,
92
97
  React.createElement("path", { d: "M12 22c5.5 0 10-4.5 10-10S17.5 2 12 2 2 6.5 2 12s4.5 10 10 10Z", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
93
98
  React.createElement("path", { d: "m7.75 12 2.83 2.83 5.67-5.66", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
99
+ case "Warning":
100
+ return (React.createElement(React.Fragment, null,
101
+ React.createElement("path", { d: "M12 7.75V13M2.92 8.58c0-1.12.6-2.16 1.57-2.73l5.94-3.43c.97-.56 2.17-.56 3.15 0l5.94 3.43c.97.56 1.57 1.6 1.57 2.73v6.84c0 1.12-.6 2.16-1.57 2.73l-5.94 3.43c-.97.56-2.17.56-3.15 0l-5.94-3.43a3.15 3.15 0 0 1-1.57-2.73v-2.76", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }),
102
+ React.createElement("path", { d: "M12 16.2v.1", stroke: this._stroke, strokeWidth: this._strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
94
103
  default:
95
104
  return null;
96
105
  }
@@ -50,12 +50,11 @@ export declare const useNotification: () => {
50
50
  message?: string;
51
51
  status: Status | number;
52
52
  }) => void;
53
- popup: ({ title, message, status, buttons, }: {
53
+ popup: ({ title, message, status, }: {
54
54
  title: string;
55
55
  message?: string;
56
56
  status: Status | number;
57
- buttons?: PopupButtonProps | null;
58
- }) => void;
57
+ }, buttons?: PopupButtonProps | null) => void;
59
58
  };
60
59
  export declare const useValidation: <TData extends object>(data: TData, params: ValidationProperties<TData>[], step?: number) => {
61
60
  onSubmit: (callback: (result: boolean) => void) => void;
@@ -33,7 +33,7 @@ export const useNotification = () => {
33
33
  setStatus && setStatus(status);
34
34
  setTrigger && setTrigger((trigger) => !trigger);
35
35
  };
36
- const popup = ({ title, message, status, buttons, }) => {
36
+ const popup = ({ title, message, status, }, buttons) => {
37
37
  setTitle && setTitle(title);
38
38
  setMessage && setMessage(message ?? "");
39
39
  setStatus && setStatus(status);
@@ -69,7 +69,7 @@ export type Errors<TData> = Partial<{
69
69
  }>;
70
70
  export type AllowedTypes = "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";
71
71
  export type IconVariants = "linear" | "bulk";
72
- export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "CloseCircle" | "CloseSquare" | "Drive" | "Document" | "Folder" | "Trash" | "Upload" | "Image" | "Import" | "Bold" | "Italic" | "Underline" | "Strikethrough" | "BulletList" | "NumberList" | "TextAlingLeft" | "TextAlingCenter" | "TextAlingRight" | "Filter" | "TickCircle" | "File";
72
+ export type Icons = "Add" | "ArrowLeft" | "ArrowRight" | "CloseCircle" | "CloseSquare" | "Drive" | "Document" | "Folder" | "Trash" | "Upload" | "Image" | "Import" | "Bold" | "Italic" | "Underline" | "Success" | "Strikethrough" | "BulletList" | "NumberList" | "TextAlingLeft" | "TextAlingCenter" | "TextAlingRight" | "Filter" | "TickCircle" | "File" | "Warning";
73
73
  export type PieChartDataType = {
74
74
  value: number;
75
75
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.67",
3
+ "version": "0.2.68",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",