ar-design 0.1.39 → 0.1.40
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/data-display/card/card.css +6 -1
- package/dist/assets/css/components/feedback/confirm/confirm.css +7 -13
- package/dist/assets/css/components/form/select/options.css +3 -4
- package/dist/components/data-display/card/IProps.d.ts +2 -0
- package/dist/components/data-display/card/index.js +4 -3
- package/dist/components/data-display/table/Actions.d.ts +1 -4
- package/dist/components/data-display/table/Actions.js +2 -1
- package/dist/components/data-display/table/index.d.ts +1 -3
- package/dist/components/feedback/confirm/IProps.d.ts +8 -0
- package/dist/components/feedback/confirm/IProps.js +1 -0
- package/dist/components/feedback/confirm/index.d.ts +2 -7
- package/dist/components/feedback/confirm/index.js +5 -5
- package/dist/components/form/select/index.js +5 -0
- package/dist/libs/core/application/contexts/Translation.d.ts +15 -0
- package/dist/libs/core/application/contexts/Translation.js +15 -0
- package/dist/libs/core/application/contexts/index.d.ts +2 -1
- package/dist/libs/core/application/contexts/index.js +2 -1
- package/dist/libs/core/application/hooks/index.d.ts +4 -0
- package/dist/libs/core/application/hooks/index.js +3 -0
- package/package.json +1 -1
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
border-radius: var(--border-radius-lg);
|
|
5
5
|
}
|
|
6
6
|
.ar-card > .title {
|
|
7
|
-
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding: 0 1rem;
|
|
12
|
+
height: 3rem;
|
|
8
13
|
border-bottom: solid 1px var(--gray-200);
|
|
9
14
|
}
|
|
10
15
|
.ar-card > .title > .ar-typography-title {
|
|
@@ -6,42 +6,36 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
gap: 1rem 0;
|
|
9
|
-
background-color:
|
|
10
|
-
backdrop-filter: blur(10px);
|
|
9
|
+
background-color: var(--white);
|
|
11
10
|
width: 250px;
|
|
12
11
|
padding: 10px;
|
|
13
12
|
border-radius: var(--border-radius-sm);
|
|
14
13
|
box-shadow: 0 0 15px -2.5px rgba(var(--black-rgb), 0.1);
|
|
15
14
|
z-index: 5;
|
|
16
15
|
}
|
|
17
|
-
.ar-confirm-wrapper > .ar-confirm::after {
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 50%;
|
|
20
|
-
transform: translateY(-50%);
|
|
21
|
-
left: 100%;
|
|
22
|
-
content: "";
|
|
23
|
-
border: solid 10px transparent;
|
|
24
|
-
border-left-color: var(--white);
|
|
25
|
-
}
|
|
26
16
|
|
|
27
17
|
/* #region Open or Close */
|
|
28
18
|
.ar-confirm-wrapper > .ar-confirm:is(.opened) {
|
|
29
19
|
visibility: visible;
|
|
30
20
|
opacity: 1;
|
|
31
|
-
transform: scale(1);
|
|
32
21
|
transition: visibility 250ms, opacity 250ms, transform 250ms ease-in-out;
|
|
33
22
|
z-index: 100;
|
|
34
23
|
}
|
|
35
24
|
.ar-confirm-wrapper > .ar-confirm:is(.closed) {
|
|
36
25
|
visibility: hidden;
|
|
37
26
|
opacity: 0;
|
|
38
|
-
transform: scale(0.8);
|
|
39
27
|
transition: visibility 250ms, opacity 250ms, transform 250ms ease-in-out;
|
|
40
28
|
z-index: 99;
|
|
41
29
|
}
|
|
42
30
|
/* #endregion */
|
|
43
31
|
/* Open or Close */
|
|
44
32
|
|
|
33
|
+
.ar-confirm-wrapper > .ar-confirm > .content {
|
|
34
|
+
max-height: 200px;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
overflow-x: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
45
39
|
.ar-confirm-wrapper > .ar-confirm > .message {
|
|
46
40
|
font-size: 0.85rem;
|
|
47
41
|
text-wrap: wrap;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.ar-select-wrapper > .options {
|
|
2
|
-
position:
|
|
3
|
-
inset: auto 0 auto 0;
|
|
2
|
+
position: fixed;
|
|
4
3
|
background-color: var(--white);
|
|
5
4
|
border: solid 1px var(--gray-200);
|
|
6
5
|
border-radius: var(--border-radius-lg);
|
|
@@ -9,11 +8,11 @@
|
|
|
9
8
|
transition: visibility 250ms, opacity 250ms, transform 250ms ease-in-out;
|
|
10
9
|
}
|
|
11
10
|
.ar-select-wrapper > .options.top {
|
|
12
|
-
inset: 100% 0 auto 0;
|
|
11
|
+
/* inset: 100% 0 auto 0; */
|
|
13
12
|
box-shadow: 0 5px 15px -2.5px rgba(var(--black-rgb), 0.1);
|
|
14
13
|
}
|
|
15
14
|
.ar-select-wrapper > .options.bottom {
|
|
16
|
-
inset: auto 0 100% 0;
|
|
15
|
+
/* inset: auto 0 100% 0; */
|
|
17
16
|
box-shadow: 0 -5px 15px -2.5px rgba(var(--black-rgb), 0.1);
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -2,10 +2,11 @@ import React from "react";
|
|
|
2
2
|
import Typography from "../typography";
|
|
3
3
|
import "../../../assets/css/components/data-display/card/card.css";
|
|
4
4
|
const { Title } = Typography;
|
|
5
|
-
const Card = ({ children, title = "" }) => {
|
|
5
|
+
const Card = ({ children, title = "", actions }) => {
|
|
6
6
|
return (React.createElement("div", { className: "ar-card" },
|
|
7
|
-
React.createElement("div", { className: "title" },
|
|
8
|
-
React.createElement(Title, { Level: "h4" }, title)
|
|
7
|
+
title && (React.createElement("div", { className: "title" },
|
|
8
|
+
React.createElement(Title, { Level: "h4" }, title),
|
|
9
|
+
React.createElement("div", null, actions))),
|
|
9
10
|
React.createElement("div", { className: "content" }, children)));
|
|
10
11
|
};
|
|
11
12
|
export default Card;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import IProps from "../../form/button/IProps";
|
|
3
2
|
declare const Actions: React.FC<{
|
|
4
|
-
children: React.ReactElement
|
|
5
|
-
children: React.ReactElement<IProps> | React.ReactElement<IProps>[];
|
|
6
|
-
}>;
|
|
3
|
+
children: React.ReactElement | React.ReactElement[];
|
|
7
4
|
}>;
|
|
8
5
|
export default Actions;
|
|
@@ -4,9 +4,7 @@ import "../../../assets/css/components/data-display/table/table.css";
|
|
|
4
4
|
declare const Table: {
|
|
5
5
|
<T extends object>({ children, data, columns, selections, pagination, config }: IProps<T>): React.JSX.Element;
|
|
6
6
|
Action: React.FC<{
|
|
7
|
-
children: React.ReactElement
|
|
8
|
-
children: React.ReactElement<import("../../form/button/IProps").default> | React.ReactElement<import("../../form/button/IProps").default>[];
|
|
9
|
-
}>;
|
|
7
|
+
children: React.ReactElement | React.ReactElement[];
|
|
10
8
|
}>;
|
|
11
9
|
};
|
|
12
10
|
export default Table;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "../../../assets/css/components/feedback/confirm/confirm.css";
|
|
3
|
-
import
|
|
4
|
-
declare const Confirm: React.FC<
|
|
5
|
-
title: string;
|
|
6
|
-
message?: string;
|
|
7
|
-
content?: React.JSX.Element;
|
|
8
|
-
onConfirm: (confirm: boolean) => void;
|
|
9
|
-
} & IChildren>;
|
|
3
|
+
import IProps from "./IProps";
|
|
4
|
+
declare const Confirm: React.FC<IProps>;
|
|
10
5
|
export default Confirm;
|
|
@@ -41,10 +41,10 @@ const Confirm = ({ children, title, message, content, onConfirm }) => {
|
|
|
41
41
|
}, [open]);
|
|
42
42
|
return (React.createElement("div", { ref: _arConfirmWrapper, className: "ar-confirm-wrapper", role: "dialog" },
|
|
43
43
|
React.createElement("div", { ref: _arConfirm, className: `ar-confirm ${open ? "opened" : "closed"}`, style: { top: coordinateY, left: coordinateX } },
|
|
44
|
-
React.createElement(Title, { Level: "h4" }, title),
|
|
44
|
+
title && React.createElement(Title, { Level: "h4" }, title),
|
|
45
45
|
message && React.createElement("p", { className: "message" }, message),
|
|
46
46
|
content && React.createElement("div", { className: "content" }, content),
|
|
47
|
-
React.createElement("div", { className: "footer" },
|
|
47
|
+
onConfirm && (React.createElement("div", { className: "footer" },
|
|
48
48
|
React.createElement(Button, { status: "success", size: "small", onClick: () => {
|
|
49
49
|
onConfirm(true);
|
|
50
50
|
setOpen(false);
|
|
@@ -52,14 +52,14 @@ const Confirm = ({ children, title, message, content, onConfirm }) => {
|
|
|
52
52
|
React.createElement(Button, { status: "light", size: "small", onClick: () => {
|
|
53
53
|
onConfirm(false);
|
|
54
54
|
setOpen(false);
|
|
55
|
-
} }, "Hay\u0131r"))),
|
|
55
|
+
} }, "Hay\u0131r")))),
|
|
56
56
|
React.createElement("div", { onClick: () => {
|
|
57
57
|
if (!_arConfirmWrapper.current || !_arConfirm.current)
|
|
58
58
|
return;
|
|
59
59
|
const wrapper = _arConfirmWrapper.current.getBoundingClientRect();
|
|
60
60
|
const confirm = _arConfirm.current.getBoundingClientRect();
|
|
61
|
-
setCoordinatX(wrapper.left - confirm.width -
|
|
62
|
-
setCoordinatY(wrapper.top
|
|
61
|
+
setCoordinatX(wrapper.left - confirm.width - 10);
|
|
62
|
+
setCoordinatY(wrapper.top);
|
|
63
63
|
setOpen((prev) => !prev);
|
|
64
64
|
} }, children)));
|
|
65
65
|
};
|
|
@@ -132,6 +132,11 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
|
|
|
132
132
|
_singleInput.current.placeholder = value?.text || placeholder || "";
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
+
if (_options.current) {
|
|
136
|
+
_options.current.style.top = `${rect?.bottom}px`;
|
|
137
|
+
_options.current.style.left = `${rect?.left}px`;
|
|
138
|
+
_options.current.style.width = `${rect?.width}px`;
|
|
139
|
+
}
|
|
135
140
|
// Options açıldıktan 100ms sonra arama kutusuna otomatik olarak focus oluyor.
|
|
136
141
|
_otoFocus = setTimeout(() => {
|
|
137
142
|
if (_searchField.current)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ContextProps = {
|
|
3
|
+
t: (key: string, ...args: any[]) => string;
|
|
4
|
+
setLanguage: React.Dispatch<React.SetStateAction<string>>;
|
|
5
|
+
};
|
|
6
|
+
type ProviderProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
translations: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
initialLanguage: string;
|
|
12
|
+
};
|
|
13
|
+
declare const TranslationContext: React.Context<ContextProps>;
|
|
14
|
+
declare const TranslationProvider: ({ children, translations, initialLanguage }: ProviderProps) => React.JSX.Element;
|
|
15
|
+
export { TranslationContext, TranslationProvider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { createContext, useState } from "react";
|
|
3
|
+
import Utils from "../../../infrastructure/shared/Utils";
|
|
4
|
+
const TranslationContext = createContext({
|
|
5
|
+
t: (key) => key,
|
|
6
|
+
setLanguage: () => { },
|
|
7
|
+
});
|
|
8
|
+
const TranslationProvider = ({ children, translations, initialLanguage }) => {
|
|
9
|
+
const [language, setLanguage] = useState(initialLanguage);
|
|
10
|
+
const t = (key, ...args) => {
|
|
11
|
+
return Utils.StringFormat(translations[language][key], args);
|
|
12
|
+
};
|
|
13
|
+
return React.createElement(TranslationContext.Provider, { value: { t, setLanguage } }, children);
|
|
14
|
+
};
|
|
15
|
+
export { TranslationContext, TranslationProvider };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ConfigProvider } from "./Config";
|
|
2
2
|
import { NotificationProvider } from "./Notification";
|
|
3
|
-
|
|
3
|
+
import { TranslationProvider } from "./Translation";
|
|
4
|
+
export { ConfigProvider, NotificationProvider, TranslationProvider };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ConfigProvider } from "./Config";
|
|
2
2
|
import { NotificationProvider } from "./Notification";
|
|
3
|
-
|
|
3
|
+
import { TranslationProvider } from "./Translation";
|
|
4
|
+
export { ConfigProvider, NotificationProvider, TranslationProvider };
|
|
@@ -44,3 +44,7 @@ export declare const useValidation: <TData extends object>(data: TData, params:
|
|
|
44
44
|
setSubmit: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
45
45
|
errors: Partial<{ [key in keyof TData]: string; }>;
|
|
46
46
|
};
|
|
47
|
+
export declare const useTranslation: () => {
|
|
48
|
+
t: (key: string, ...args: any[]) => string;
|
|
49
|
+
setLanguage: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
50
|
+
};
|
|
@@ -2,6 +2,7 @@ import { useContext, useEffect, useRef, useState } from "react";
|
|
|
2
2
|
import { ConfigContext } from "../contexts/Config";
|
|
3
3
|
import { NotificationContext } from "../contexts/Notification";
|
|
4
4
|
import Utils from "../../../infrastructure/shared/Utils";
|
|
5
|
+
import { TranslationContext } from "../contexts/Translation";
|
|
5
6
|
export const useLayout = () => {
|
|
6
7
|
const context = useContext(ConfigContext);
|
|
7
8
|
if (!context) {
|
|
@@ -85,3 +86,5 @@ export const useValidation = function (data, params) {
|
|
|
85
86
|
errors,
|
|
86
87
|
};
|
|
87
88
|
};
|
|
89
|
+
// Custom hook for easier usage of context
|
|
90
|
+
export const useTranslation = () => useContext(TranslationContext);
|