ar-design 0.1.21 → 0.1.23
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/chip/chip.css +1 -0
- package/dist/assets/css/components/data-display/divider/divider.css +4 -1
- package/dist/assets/css/components/data-display/paper/paper.css +20 -0
- package/dist/assets/css/components/data-display/table/scroll.css +61 -0
- package/dist/assets/css/components/data-display/table/table.css +89 -0
- package/dist/assets/css/components/data-display/typography/title/core.css +1 -2
- package/dist/assets/css/components/feedback/alert/alert.css +0 -1
- package/dist/assets/css/components/feedback/modal/content.css +6 -0
- package/dist/assets/css/components/feedback/modal/footer.css +9 -0
- package/dist/assets/css/components/feedback/modal/header.css +56 -0
- package/dist/assets/css/components/feedback/modal/modal.css +54 -0
- package/dist/assets/css/components/feedback/notification/notification.css +162 -0
- package/dist/assets/css/components/form/button/button.css +7 -0
- package/dist/assets/css/components/form/button/core/icon.css +15 -15
- package/dist/assets/css/components/form/button-group/button-group.css +6 -0
- package/dist/assets/css/components/form/checkbox/core/border.css +1 -2
- package/dist/assets/css/components/form/date-picker/calendar/content.css +68 -0
- package/dist/assets/css/components/form/date-picker/calendar/footer.css +10 -0
- package/dist/assets/css/components/form/date-picker/calendar/header.css +33 -0
- package/dist/assets/css/components/form/date-picker/clock/clock.css +30 -0
- package/dist/assets/css/components/form/date-picker/clock/content.css +56 -0
- package/dist/assets/css/components/form/date-picker/clock/footer.css +7 -0
- package/dist/assets/css/components/form/date-picker/clock/header.css +6 -0
- package/dist/assets/css/components/form/date-picker/date-picker.css +51 -0
- package/dist/assets/css/components/form/input/core/border.css +1 -2
- package/dist/assets/css/components/form/input/core/button.css +1 -2
- package/dist/assets/css/components/form/select/options.css +2 -1
- package/dist/assets/css/components/form/switch/core/border.css +1 -2
- package/dist/assets/css/components/layout/header.css +1 -0
- package/dist/assets/css/components/layout/layout.css +0 -2
- package/dist/assets/css/components/navigation/menu/menu.css +1 -0
- package/dist/assets/css/components/navigation/pagination/pagination.css +60 -0
- package/dist/assets/css/core/ar-core.css +19 -4
- package/dist/assets/css/core/variants/animation.css +1 -2
- package/dist/assets/css/core/variants/borderless/borderless.css +25 -50
- package/dist/assets/css/core/variants/dashed/dashed.css +9 -10
- package/dist/assets/css/core/variants/filled/filled.css +57 -26
- package/dist/assets/css/core/variants/outlined/outlined.css +10 -11
- package/dist/components/data-display/chip/index.js +5 -11
- package/dist/components/data-display/paper/index.d.ts +8 -0
- package/dist/components/data-display/paper/index.js +12 -0
- package/dist/components/data-display/table/Actions.d.ts +8 -0
- package/dist/components/data-display/table/Actions.js +2 -0
- package/dist/components/data-display/table/IProps.d.ts +14 -0
- package/dist/components/data-display/table/IProps.js +1 -0
- package/dist/components/data-display/table/index.d.ts +12 -0
- package/dist/components/data-display/table/index.js +217 -0
- package/dist/components/feedback/modal/IProps.d.ts +20 -0
- package/dist/components/feedback/modal/IProps.js +1 -0
- package/dist/components/feedback/modal/index.d.ts +5 -0
- package/dist/components/feedback/modal/index.js +45 -0
- package/dist/components/feedback/notification/IProps.d.ts +9 -0
- package/dist/components/feedback/notification/IProps.js +1 -0
- package/dist/components/feedback/notification/index.d.ts +5 -0
- package/dist/components/feedback/notification/index.js +40 -0
- package/dist/components/form/button/IProps.d.ts +1 -1
- package/dist/components/form/button/index.js +12 -26
- package/dist/components/form/button-group/index.js +5 -6
- package/dist/components/form/checkbox/IProps.d.ts +1 -1
- package/dist/components/form/checkbox/index.d.ts +1 -1
- package/dist/components/form/checkbox/index.js +11 -18
- package/dist/components/form/date-picker/Props.d.ts +7 -0
- package/dist/components/form/date-picker/Props.js +1 -0
- package/dist/components/form/date-picker/index.d.ts +5 -0
- package/dist/components/form/date-picker/index.js +328 -0
- package/dist/components/form/input/IProps.d.ts +1 -1
- package/dist/components/form/input/index.js +19 -35
- package/dist/components/form/select/Props.d.ts +1 -1
- package/dist/components/form/select/index.js +48 -44
- package/dist/components/form/switch/index.js +4 -3
- package/dist/components/layout/Header.js +1 -1
- package/dist/components/layout/IProps.d.ts +2 -2
- package/dist/components/layout/LSider.js +2 -2
- package/dist/components/layout/RSider.js +3 -3
- package/dist/components/layout/index.js +5 -8
- package/dist/components/navigation/menu/Types.d.ts +1 -1
- package/dist/components/navigation/menu/index.js +12 -10
- package/dist/components/navigation/pagination/IProps.d.ts +7 -0
- package/dist/components/navigation/pagination/IProps.js +1 -0
- package/dist/components/navigation/pagination/index.d.ts +5 -0
- package/dist/components/navigation/pagination/index.js +77 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +11 -10
- package/dist/libs/core/application/contexts/Config.d.ts +26 -0
- package/dist/libs/core/application/contexts/Config.js +20 -0
- package/dist/libs/core/application/contexts/Notification.d.ts +16 -0
- package/dist/libs/core/application/contexts/Notification.js +19 -0
- package/dist/libs/core/application/contexts/index.d.ts +3 -0
- package/dist/libs/core/application/contexts/index.js +3 -0
- package/dist/libs/core/application/hooks/index.d.ts +32 -18
- package/dist/libs/core/application/hooks/index.js +15 -2
- package/dist/libs/core/service/Api.d.ts +35 -0
- package/dist/libs/core/service/Api.js +86 -0
- package/dist/libs/core/service/index.d.ts +28 -0
- package/dist/libs/core/service/index.js +48 -0
- package/dist/libs/infrastructure/shared/Utils.d.ts +6 -0
- package/dist/libs/infrastructure/shared/Utils.js +15 -0
- package/dist/libs/types/IGlobalProps.d.ts +46 -13
- package/dist/libs/types/index.d.ts +22 -2
- package/package.json +3 -1
- package/dist/libs/core/application/contexts/Layout.d.ts +0 -23
- package/dist/libs/core/application/contexts/Layout.js +0 -17
- package/dist/libs/index.d.ts +0 -0
- package/dist/libs/index.js +0 -3
|
@@ -2,45 +2,29 @@
|
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/input/input.css";
|
|
4
4
|
import Button from "../button";
|
|
5
|
-
|
|
5
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
6
|
+
const Input = forwardRef(({ variant = "outlined", status = "light", size = "normal", icon, border = { radius: "sm" }, button, addon, ...attributes }, ref) => {
|
|
6
7
|
// variables
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// input wrapper className
|
|
13
|
-
if (icon && icon.element) {
|
|
14
|
-
_inputWrapperClassName += ` icon`;
|
|
15
|
-
_inputWrapperClassName += ` icon-${icon.position ?? "start"}`;
|
|
16
|
-
}
|
|
17
|
-
// input className
|
|
18
|
-
if (variant)
|
|
19
|
-
_inputClassName += `${variant}`;
|
|
20
|
-
if (status)
|
|
21
|
-
_inputClassName += ` ${status}`;
|
|
22
|
-
// border radius
|
|
23
|
-
_inputClassName += ` border-radius-${border.radius}`;
|
|
8
|
+
const _wrapperClassName = ["ar-input-wrapper"];
|
|
9
|
+
const _addonBeforeClassName = ["addon-before"];
|
|
10
|
+
const _addonAfterClassName = ["addon-after"];
|
|
11
|
+
const _inputClassName = [];
|
|
12
|
+
_inputClassName.push(...Utils.GetClassName(variant, status, border, size, icon, attributes.className));
|
|
24
13
|
// addon className
|
|
25
14
|
if (addon) {
|
|
26
|
-
_wrapperClassName
|
|
27
|
-
|
|
28
|
-
_addonBeforeClassName
|
|
29
|
-
_addonAfterClassName
|
|
30
|
-
|
|
31
|
-
_addonBeforeClassName
|
|
32
|
-
_addonAfterClassName
|
|
33
|
-
// border radius
|
|
34
|
-
_addonBeforeClassName += ` border-radius-${border?.radius || "sm"}`;
|
|
35
|
-
_addonAfterClassName += ` border-radius-${border?.radius || "sm"}`;
|
|
15
|
+
_wrapperClassName.push("addon");
|
|
16
|
+
_addonBeforeClassName.push(`${addon.variant || "filled"}`);
|
|
17
|
+
_addonBeforeClassName.push(`${status}`);
|
|
18
|
+
_addonAfterClassName.push(`${addon.variant || "filled"}`);
|
|
19
|
+
_addonAfterClassName.push(`${status}`);
|
|
20
|
+
_addonBeforeClassName.push(`border-radius-${border.radius}`);
|
|
21
|
+
_addonAfterClassName.push(`border-radius-${border.radius}`);
|
|
36
22
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
addon?.before && React.createElement("span", { className: _addonBeforeClassName }, addon?.before),
|
|
41
|
-
React.createElement("div", { className: _inputWrapperClassName },
|
|
23
|
+
return (React.createElement("div", { className: _wrapperClassName.map((c) => c).join(" ") },
|
|
24
|
+
addon?.before && (React.createElement("span", { className: _addonBeforeClassName.map((c) => c).join(" ") }, addon?.before)),
|
|
25
|
+
React.createElement("div", { className: "ar-input" },
|
|
42
26
|
icon?.element && React.createElement("span", { className: "icon-element" }, icon.element),
|
|
43
|
-
React.createElement("input", { ref: ref, ...attributes, size: 20, className: _inputClassName, onChange: (event) => {
|
|
27
|
+
React.createElement("input", { ref: ref, ...attributes, size: 20, className: _inputClassName.map((c) => c).join(" "), onChange: (event) => {
|
|
44
28
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
45
29
|
if (attributes.disabled)
|
|
46
30
|
return;
|
|
@@ -57,7 +41,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", icon, border
|
|
|
57
41
|
}
|
|
58
42
|
})();
|
|
59
43
|
} })),
|
|
60
|
-
addon?.after && React.createElement("span", { className: _addonAfterClassName }, addon?.after),
|
|
44
|
+
addon?.after && (React.createElement("span", { className: _addonAfterClassName.map((c) => c).join(" ") }, addon?.after)),
|
|
61
45
|
button && (React.createElement(Button, { ...button, status: status, border: { radius: border.radius }, disabled: attributes.disabled }))));
|
|
62
46
|
});
|
|
63
47
|
Input.displayName = "Input";
|
|
@@ -5,9 +5,9 @@ import "../../../assets/css/components/form/select/select.css";
|
|
|
5
5
|
import Chip from "../../data-display/chip";
|
|
6
6
|
import Checkbox from "../checkbox";
|
|
7
7
|
import Paragraph from "../../data-display/typography/paragraph/Paragraph";
|
|
8
|
-
const Select = ({ variant = "outlined", status, border, options, onChange, multiple, defaultValueIndex, ...attributes }) => {
|
|
8
|
+
const Select = ({ variant = "outlined", status, border = { radius: "sm" }, options, onChange, multiple, defaultValueIndex, ...attributes }) => {
|
|
9
9
|
// refs
|
|
10
|
-
let _selectionClassName =
|
|
10
|
+
let _selectionClassName = "selections";
|
|
11
11
|
const _arSelect = useRef(null);
|
|
12
12
|
const _singleInput = useRef(null);
|
|
13
13
|
const _multipleInput = useRef(null);
|
|
@@ -19,18 +19,18 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
19
19
|
let _selectedItemIndex = useRef(0);
|
|
20
20
|
// states
|
|
21
21
|
const [optionsOpen, setOptionsOpen] = useState(false);
|
|
22
|
+
let [optionsClassName, setOptionsClassName] = useState(["options", "closed"]);
|
|
22
23
|
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
23
24
|
const [searchText, setSearchText] = useState("");
|
|
24
25
|
const [selection, setSelection] = useState(undefined);
|
|
25
26
|
const [selections, setSelections] = useState([]);
|
|
26
27
|
const [navigationIndex, setNavigationIndex] = useState(0);
|
|
27
|
-
let [optionsClassName, setOptionsClassName] = useState(["options", "closed"]);
|
|
28
28
|
// selection className
|
|
29
29
|
if (variant)
|
|
30
30
|
_selectionClassName += ` ${variant}`;
|
|
31
31
|
_selectionClassName += multiple ? ` ${status?.color || "light"}` : status || "light";
|
|
32
32
|
// border
|
|
33
|
-
_selectionClassName += ` border-radius-${border
|
|
33
|
+
_selectionClassName += ` border-radius-${border.radius}`;
|
|
34
34
|
_selectionClassName += ` border-style-solid}`;
|
|
35
35
|
// methods
|
|
36
36
|
const handleClickOutSide = (event) => {
|
|
@@ -39,6 +39,40 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
39
39
|
setOptionsOpen(false);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
const handleKeys = (event) => {
|
|
43
|
+
const key = event.key;
|
|
44
|
+
const optionItems = _optionItems.current.filter((optionItem) => optionItem !== null);
|
|
45
|
+
if (key === "ArrowUp" || key === "ArrowLeft") {
|
|
46
|
+
setNavigationIndex((prev) => {
|
|
47
|
+
let result = 0;
|
|
48
|
+
if (prev > 0)
|
|
49
|
+
result = prev - 1;
|
|
50
|
+
if (prev === 0)
|
|
51
|
+
result = optionItems.length - 1;
|
|
52
|
+
_navigationIndex.current = result;
|
|
53
|
+
return result;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else if (key === "ArrowDown" || key === "ArrowRight") {
|
|
57
|
+
setNavigationIndex((prev) => {
|
|
58
|
+
let result = 0;
|
|
59
|
+
if (prev === optionItems.length - 1)
|
|
60
|
+
result = 0;
|
|
61
|
+
if (prev < optionItems.length - 1)
|
|
62
|
+
result = prev + 1;
|
|
63
|
+
_navigationIndex.current = result;
|
|
64
|
+
return result;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else if (key === "Enter") {
|
|
68
|
+
if (_navigationIndex.current === -1)
|
|
69
|
+
return;
|
|
70
|
+
optionItems[_navigationIndex.current]?.click();
|
|
71
|
+
}
|
|
72
|
+
else if (key === "Escape") {
|
|
73
|
+
setOptionsOpen(false);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
42
76
|
const handleItemSelected = (option, index) => {
|
|
43
77
|
// Multiple
|
|
44
78
|
if (multiple) {
|
|
@@ -77,41 +111,8 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
77
111
|
_optionItems.current[index]?.classList.add("selectedItem");
|
|
78
112
|
}
|
|
79
113
|
};
|
|
80
|
-
const handleKeys = (event) => {
|
|
81
|
-
const key = event.key;
|
|
82
|
-
const optionItems = _optionItems.current.filter((optionItem) => optionItem !== null);
|
|
83
|
-
if (key === "ArrowUp" || key === "ArrowLeft") {
|
|
84
|
-
setNavigationIndex((prev) => {
|
|
85
|
-
let result = 0;
|
|
86
|
-
if (prev > 0)
|
|
87
|
-
result = prev - 1;
|
|
88
|
-
if (prev === 0)
|
|
89
|
-
result = optionItems.length - 1;
|
|
90
|
-
_navigationIndex.current = result;
|
|
91
|
-
return result;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
else if (key === "ArrowDown" || key === "ArrowRight") {
|
|
95
|
-
setNavigationIndex((prev) => {
|
|
96
|
-
let result = 0;
|
|
97
|
-
if (prev === optionItems.length - 1)
|
|
98
|
-
result = 0;
|
|
99
|
-
if (prev < optionItems.length - 1)
|
|
100
|
-
result = prev + 1;
|
|
101
|
-
_navigationIndex.current = result;
|
|
102
|
-
return result;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
else if (key === "Enter") {
|
|
106
|
-
if (_navigationIndex.current === -1)
|
|
107
|
-
return;
|
|
108
|
-
optionItems[_navigationIndex.current]?.click();
|
|
109
|
-
}
|
|
110
|
-
else if (key === "Escape") {
|
|
111
|
-
setOptionsOpen(false);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
114
|
// effects
|
|
115
|
+
useEffect(() => setFilteredOptions(options), [options]);
|
|
115
116
|
useEffect(() => {
|
|
116
117
|
const optionItems = _optionItems.current.filter((optionItem) => optionItem !== null);
|
|
117
118
|
const screenCenter = window.innerHeight / 2 + 100;
|
|
@@ -131,7 +132,7 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
131
132
|
_singleInput.current.value = "";
|
|
132
133
|
_singleInput.current.placeholder = selection?.text || attributes.placeholder || "";
|
|
133
134
|
}
|
|
134
|
-
optionItems[_selectedItemIndex.current]
|
|
135
|
+
optionItems[_selectedItemIndex.current]?.scrollIntoView({
|
|
135
136
|
behavior: "smooth",
|
|
136
137
|
block: "start",
|
|
137
138
|
});
|
|
@@ -168,7 +169,7 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
168
169
|
}, [optionsOpen]);
|
|
169
170
|
useEffect(() => {
|
|
170
171
|
// Arama kriterlerine uygun olan değerleri bir state e gönderiyoruz.
|
|
171
|
-
setFilteredOptions(options
|
|
172
|
+
setFilteredOptions(options?.filter((option) => {
|
|
172
173
|
if (!optionsOpen)
|
|
173
174
|
return option;
|
|
174
175
|
return option.text.toLowerCase().includes(searchText.toLowerCase());
|
|
@@ -211,7 +212,7 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
211
212
|
multiple ? (React.createElement("div", { className: _selectionClassName, onClick: () => setOptionsOpen((x) => !x) },
|
|
212
213
|
React.createElement("div", { className: "items" }, selections.length > 0 ? (selections.map((selection, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled", status: status?.selected?.color || status?.color, text: selection.text })))) : (React.createElement("span", { className: `placeholder ${status?.color || "light"}` }, attributes.placeholder))))) : (
|
|
213
214
|
// Single
|
|
214
|
-
React.createElement(Input, { ref: _singleInput, variant: variant, status: status || "light", onClick: () => setOptionsOpen((
|
|
215
|
+
React.createElement(Input, { ref: _singleInput, variant: variant, status: status || "light", border: { radius: border.radius }, onClick: () => setOptionsOpen((prev) => !prev), onChange: () => !optionsOpen && setOptionsOpen(true), onKeyUp: (event) => {
|
|
215
216
|
if (event.key === "Enter")
|
|
216
217
|
return;
|
|
217
218
|
// Arama yapmak için kullanılan state bu kısımda dolduruluyor.
|
|
@@ -235,14 +236,17 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
235
236
|
onChange(undefined);
|
|
236
237
|
}
|
|
237
238
|
} })),
|
|
238
|
-
React.createElement("span", { className: `angel-down ${optionsOpen ? "opened" : "closed"}`, onClick: () =>
|
|
239
|
-
|
|
239
|
+
React.createElement("span", { className: `angel-down ${optionsOpen ? "opened" : "closed"}`, onClick: (event) => {
|
|
240
|
+
event.stopPropagation();
|
|
241
|
+
setOptionsOpen((x) => !x);
|
|
242
|
+
} })),
|
|
243
|
+
React.createElement("div", { ref: _options, className: optionsClassName.map((c) => c).join(" ") },
|
|
240
244
|
multiple && (React.createElement("div", { className: "search-field" },
|
|
241
245
|
React.createElement(Input, { ref: _searchField, variant: "outlined", status: "light", placeholder: "Search...", onKeyUp: (event) => {
|
|
242
246
|
// Arama yapmak için kullanılan state bu kısımda dolduruluyor.
|
|
243
247
|
setSearchText(event.currentTarget.value);
|
|
244
248
|
} }))),
|
|
245
|
-
filteredOptions
|
|
249
|
+
filteredOptions?.length > 0 ? (React.createElement("ul", null, filteredOptions?.map((option, index) => {
|
|
246
250
|
const isItem = selections.some((selection) => selection.value === option.value);
|
|
247
251
|
return (React.createElement("li", { ref: (element) => (_optionItems.current[index] = element), key: index, onClick: () => handleItemSelected(option, index) },
|
|
248
252
|
multiple && (React.createElement(Checkbox, { checked: isItem, status: isItem ? status?.selected?.color || status?.color : "light", disabled: true })),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import React, { useRef } from "react";
|
|
2
3
|
import "../../../assets/css/components/form/switch/switch.css";
|
|
3
|
-
const Switch = ({ label, status = "primary", border, ...attributes }) => {
|
|
4
|
+
const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...attributes }) => {
|
|
4
5
|
// refs
|
|
5
6
|
let _switch = useRef(null);
|
|
6
7
|
// variables
|
|
@@ -11,8 +12,8 @@ const Switch = ({ label, status = "primary", border, ...attributes }) => {
|
|
|
11
12
|
_switchClassName += ` light`;
|
|
12
13
|
// border
|
|
13
14
|
_switchClassName += ` border-style-solid`;
|
|
14
|
-
_switchClassName += ` border-radius-${border
|
|
15
|
-
_handleClassName += ` border-radius-${border
|
|
15
|
+
_switchClassName += ` border-radius-${border.radius}`;
|
|
16
|
+
_handleClassName += ` border-radius-${border.radius}`;
|
|
16
17
|
return (React.createElement("div", { className: _wrapperClassName },
|
|
17
18
|
React.createElement("label", null,
|
|
18
19
|
React.createElement("input", { type: attributes.type || "checkbox", ...attributes, size: 0, onChange: (event) => {
|
|
@@ -5,7 +5,7 @@ const Header = ({ logo, menu }) => {
|
|
|
5
5
|
return (React.createElement("header", null,
|
|
6
6
|
React.createElement("div", { className: "ar-header-with-wrap" },
|
|
7
7
|
typeof logo === "string" ? React.createElement("h1", null, logo) : logo,
|
|
8
|
-
React.createElement(Menu, {
|
|
8
|
+
menu && menu.length > 0 && React.createElement(Menu, { data: menu, variant: "horizontal" }))));
|
|
9
9
|
};
|
|
10
10
|
Header.displayName = "Layout.Header";
|
|
11
11
|
export default Header;
|
|
@@ -3,8 +3,8 @@ import { IGlobalProps } from "../../libs/types/IGlobalProps";
|
|
|
3
3
|
interface ILayoutProps extends Omit<IGlobalProps, "variant" | "status" | "icon" | "border" | "size" | "upperCase"> {
|
|
4
4
|
}
|
|
5
5
|
interface IHeaderProps {
|
|
6
|
-
logo
|
|
7
|
-
menu
|
|
6
|
+
logo?: string | React.JSX.Element;
|
|
7
|
+
menu?: MenuProps[];
|
|
8
8
|
}
|
|
9
9
|
interface IMainProps extends Omit<IGlobalProps, "variant" | "status" | "icon" | "border" | "size" | "upperCase"> {
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@ import React from "react";
|
|
|
3
3
|
import { useLayout } from "../../libs/core/application/hooks";
|
|
4
4
|
const LSider = () => {
|
|
5
5
|
// hooks
|
|
6
|
-
const { options } = useLayout();
|
|
7
|
-
const sider = options
|
|
6
|
+
const { config: options } = useLayout();
|
|
7
|
+
const sider = options.layout.sider.left;
|
|
8
8
|
if (!sider?.active)
|
|
9
9
|
return null;
|
|
10
10
|
return React.createElement("aside", { className: "ar-aside left" }, sider.element);
|
|
@@ -3,9 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { useLayout } from "../../libs/core/application/hooks";
|
|
4
4
|
const RSider = () => {
|
|
5
5
|
// hooks
|
|
6
|
-
const { options } = useLayout();
|
|
7
|
-
const sider = options
|
|
8
|
-
if (!sider
|
|
6
|
+
const { config: options } = useLayout();
|
|
7
|
+
const sider = options.layout.sider.right;
|
|
8
|
+
if (!sider.active)
|
|
9
9
|
return null;
|
|
10
10
|
return React.createElement("aside", { className: "ar-aside right" }, sider.element);
|
|
11
11
|
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import Footer from "./Footer";
|
|
4
3
|
import "../../assets/css/components/layout/layout.css";
|
|
5
4
|
import Header from "./Header";
|
|
6
5
|
import Section from "./Section";
|
|
7
|
-
import { LayoutProvider } from "../../libs/core/application/contexts/Layout";
|
|
8
6
|
import Main from "./Main";
|
|
9
7
|
import LSider from "./LSider";
|
|
10
8
|
import RSider from "./RSider";
|
|
11
9
|
const Layout = ({ children }) => {
|
|
12
|
-
return (React.createElement(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}))));
|
|
10
|
+
return (React.createElement("div", { className: "ar-layout" }, React.Children.map(children, (child) => {
|
|
11
|
+
if (!React.isValidElement(child))
|
|
12
|
+
return;
|
|
13
|
+
return child;
|
|
14
|
+
})));
|
|
18
15
|
};
|
|
19
16
|
Layout.Header = Header;
|
|
20
17
|
Layout.Main = Main;
|
|
@@ -46,12 +46,12 @@ const SubMenu = ({ items, variant, type, setSelectedMenu, selectedMenu, setSelec
|
|
|
46
46
|
if (variant === "horizontal" || item.type !== "group")
|
|
47
47
|
_className_groupTitle += " ar-angle-down";
|
|
48
48
|
// Eğer seçili olan menüyse "selected" sınıfını ekler.
|
|
49
|
-
if (selectedMenu.length > 0 && selectedMenu.includes(item) && item.type !== "group")
|
|
49
|
+
if (selectedMenu.length > 0 && selectedMenu.includes(item) && item.type !== "group") {
|
|
50
50
|
_className_li += " selected";
|
|
51
|
+
}
|
|
51
52
|
}
|
|
52
53
|
// Eğer seçili olan menüyse "selected" sınıfını ekler.
|
|
53
|
-
if (selectedItem === item)
|
|
54
|
-
_className_groupTitle += " selected";
|
|
54
|
+
// if (selectedItem === item) _className_groupTitle += " selected";
|
|
55
55
|
return (React.createElement("li", { key: index, className: _className_li, onClick: (event) => {
|
|
56
56
|
if (item.submenu && item.submenu.length > 0)
|
|
57
57
|
handleOnClick(event, item, variant, null, setSelectedMenu);
|
|
@@ -62,7 +62,7 @@ const SubMenu = ({ items, variant, type, setSelectedMenu, selectedMenu, setSelec
|
|
|
62
62
|
item.submenu && (React.createElement(SubMenu, { items: item.submenu, variant: variant, type: item.type, setSelectedMenu: setSelectedMenu, selectedMenu: selectedMenu, setSelectedItem: setSelectedItem, selectedItem: selectedItem }))));
|
|
63
63
|
})));
|
|
64
64
|
};
|
|
65
|
-
const Menu = ({
|
|
65
|
+
const Menu = ({ data, variant = "vertical", ...attributes }) => {
|
|
66
66
|
// refs
|
|
67
67
|
let _className_li = useRef("ar-menu-list-item").current;
|
|
68
68
|
// states
|
|
@@ -75,7 +75,7 @@ const Menu = ({ menu, variant = "vertical", ...attributes }) => {
|
|
|
75
75
|
return className;
|
|
76
76
|
};
|
|
77
77
|
return (React.createElement("nav", { className: "ar-menu", ...attributes },
|
|
78
|
-
React.createElement("ul", { className: handleClassName() },
|
|
78
|
+
React.createElement("ul", { className: handleClassName() }, data.map((item, index) => {
|
|
79
79
|
// refs
|
|
80
80
|
let _className_groupTitle = useRef("ar-menu-list-item-group-item-title").current;
|
|
81
81
|
if (variant === "vertical" && item.type === "group")
|
|
@@ -85,11 +85,13 @@ const Menu = ({ menu, variant = "vertical", ...attributes }) => {
|
|
|
85
85
|
_className_groupTitle += " ar-angle-down";
|
|
86
86
|
}
|
|
87
87
|
// Eğer seçili olan menüyse "selected" sınıfını ekler.
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
// if (
|
|
89
|
+
// selectedMenu.length > 0 &&
|
|
90
|
+
// selectedMenu.includes(item) &&
|
|
91
|
+
// item.type !== "group" &&
|
|
92
|
+
// variant !== "horizontal"
|
|
93
|
+
// )
|
|
94
|
+
// _className_li += " selected";
|
|
93
95
|
return (React.createElement("li", { key: index, className: _className_li, onClick: (event) => handleOnClick(event, item, variant, null, setSelectedMenu) },
|
|
94
96
|
item.type === "divider" ? (React.createElement(Divider, null)) : (React.createElement("div", { className: _className_groupTitle }, item.render)),
|
|
95
97
|
item.submenu && (React.createElement(SubMenu, { items: item.submenu, variant: variant, type: item.type, setSelectedMenu: setSelectedMenu, selectedMenu: selectedMenu, setSelectedItem: setSelectedItem, selectedItem: selectedItem }))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useContext, useEffect, useState } from "react";
|
|
3
|
+
import "../../../assets/css/components/navigation/pagination/pagination.css";
|
|
4
|
+
import { ConfigContext } from "../../../libs/core/application/contexts/Config";
|
|
5
|
+
const Pagination = ({ defaultCurrent = 1, perPage, total, onChange }) => {
|
|
6
|
+
// context
|
|
7
|
+
const { config } = useContext(ConfigContext);
|
|
8
|
+
// states
|
|
9
|
+
const [pages, setPages] = useState([]);
|
|
10
|
+
const [currentPage, setCurrentPage] = useState(defaultCurrent);
|
|
11
|
+
// useEffect
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (total === 0)
|
|
14
|
+
return;
|
|
15
|
+
const totalPages = Math.ceil(total / (perPage || config.perPage));
|
|
16
|
+
const liItems = [];
|
|
17
|
+
// Başlangıç ve bitiş aralığını hesapla.
|
|
18
|
+
const startPage = Math.max(1, currentPage - 1);
|
|
19
|
+
const endPage = Math.min(totalPages, currentPage + 1);
|
|
20
|
+
// İlk sayfa ve ... eklemek.
|
|
21
|
+
if (startPage > 1) {
|
|
22
|
+
liItems.push(React.createElement("li", { key: 1, onClick: () => setCurrentPage(1) }, "1"));
|
|
23
|
+
if (startPage > 2) {
|
|
24
|
+
liItems.push(React.createElement("li", { key: "start-ellipsis", className: "start-ellipsis" }, "..."));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Sayfa aralığını eklemek.
|
|
28
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
29
|
+
liItems.push(React.createElement("li", { key: i, className: i === currentPage ? "selection-page" : "", onClick: () => setCurrentPage(i) }, i));
|
|
30
|
+
}
|
|
31
|
+
// Son sayfa ve ... eklemek.
|
|
32
|
+
if (endPage < totalPages) {
|
|
33
|
+
if (endPage < totalPages - 1) {
|
|
34
|
+
liItems.push(React.createElement("li", { key: "end-ellipsis", className: "end-ellipsis" }, "..."));
|
|
35
|
+
}
|
|
36
|
+
liItems.push(React.createElement("li", { key: totalPages, onClick: () => setCurrentPage(totalPages) }, totalPages));
|
|
37
|
+
}
|
|
38
|
+
setPages(liItems);
|
|
39
|
+
onChange(currentPage, perPage || config.perPage);
|
|
40
|
+
}, [total, currentPage]);
|
|
41
|
+
return (React.createElement("div", { className: "ar-pagination" },
|
|
42
|
+
React.createElement("ul", null,
|
|
43
|
+
React.createElement("li", { className: currentPage === 1 ? "passive" : "", onClick: () => {
|
|
44
|
+
if (currentPage === 1)
|
|
45
|
+
return;
|
|
46
|
+
setCurrentPage(1);
|
|
47
|
+
} },
|
|
48
|
+
React.createElement("span", null, "«")),
|
|
49
|
+
React.createElement("li", { className: currentPage === 1 ? "passive" : "", onClick: () => {
|
|
50
|
+
if (currentPage === 1)
|
|
51
|
+
return;
|
|
52
|
+
setCurrentPage((prev) => {
|
|
53
|
+
if (prev === 1)
|
|
54
|
+
return prev;
|
|
55
|
+
return (prev -= 1);
|
|
56
|
+
});
|
|
57
|
+
} },
|
|
58
|
+
React.createElement("span", null, "‹")),
|
|
59
|
+
pages,
|
|
60
|
+
React.createElement("li", { className: Math.ceil(total / (perPage || config.perPage)) === currentPage ? "passive" : "", onClick: () => {
|
|
61
|
+
if (Math.ceil(total / (perPage || config.perPage)) === currentPage)
|
|
62
|
+
return;
|
|
63
|
+
setCurrentPage((prev) => {
|
|
64
|
+
if (prev === Math.ceil(total / (perPage || config.perPage)))
|
|
65
|
+
return prev;
|
|
66
|
+
return (prev += 1);
|
|
67
|
+
});
|
|
68
|
+
} },
|
|
69
|
+
React.createElement("span", null, "›")),
|
|
70
|
+
React.createElement("li", { className: Math.ceil(total / (perPage || config.perPage)) === currentPage ? "passive" : "", onClick: () => {
|
|
71
|
+
if (Math.ceil(total / (perPage || config.perPage)) === currentPage)
|
|
72
|
+
return;
|
|
73
|
+
setCurrentPage(Math.ceil(total / (perPage || config.perPage)));
|
|
74
|
+
} },
|
|
75
|
+
React.createElement("span", null, "»")))));
|
|
76
|
+
};
|
|
77
|
+
export default Pagination;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,17 +2,21 @@ import "./assets/css/core/ar-core.css";
|
|
|
2
2
|
import Button from "./components/form/button";
|
|
3
3
|
import ButtonGroup from "./components/form/button-group";
|
|
4
4
|
import Input from "./components/form/input";
|
|
5
|
+
import DatePicker from "./components/form/date-picker";
|
|
5
6
|
import Select from "./components/form/select";
|
|
6
7
|
import Checkbox from "./components/form/checkbox";
|
|
7
8
|
import Switch from "./components/form/switch";
|
|
8
9
|
import Radio from "./components/form/radio";
|
|
9
10
|
import Card from "./components/data-display/card";
|
|
10
11
|
import Chip from "./components/data-display/chip";
|
|
11
|
-
import Typography from "./components/data-display/typography";
|
|
12
12
|
import Divider from "./components/data-display/divider";
|
|
13
|
+
import Paper from "./components/data-display/paper";
|
|
13
14
|
import SyntaxHighlighter from "./components/data-display/syntax-highlighter";
|
|
15
|
+
import Table from "./components/data-display/table";
|
|
16
|
+
import Typography from "./components/data-display/typography";
|
|
14
17
|
import Alert from "./components/feedback/alert";
|
|
15
|
-
import
|
|
18
|
+
import Modal from "./components/feedback/modal";
|
|
19
|
+
import MenuType from "./components/navigation/menu";
|
|
16
20
|
import Grid from "./components/layout/grid-system";
|
|
17
21
|
import Layout from "./components/layout";
|
|
18
|
-
export { Button, ButtonGroup, Input, Select, Switch, Checkbox, Radio, Card, Chip,
|
|
22
|
+
export { Button, ButtonGroup, Input, DatePicker, Select, Switch, Checkbox, Radio, Card, Chip, Divider, Paper, SyntaxHighlighter, Table, Typography, Alert, Modal, MenuType as Menu, Grid, Layout, };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import "./assets/css/core/ar-core.css";
|
|
|
3
3
|
import Button from "./components/form/button";
|
|
4
4
|
import ButtonGroup from "./components/form/button-group";
|
|
5
5
|
import Input from "./components/form/input";
|
|
6
|
+
import DatePicker from "./components/form/date-picker";
|
|
6
7
|
import Select from "./components/form/select";
|
|
7
8
|
import Checkbox from "./components/form/checkbox";
|
|
8
9
|
import Switch from "./components/form/switch";
|
|
@@ -10,27 +11,27 @@ import Radio from "./components/form/radio";
|
|
|
10
11
|
// Data Display
|
|
11
12
|
import Card from "./components/data-display/card";
|
|
12
13
|
import Chip from "./components/data-display/chip";
|
|
13
|
-
import Typography from "./components/data-display/typography";
|
|
14
14
|
import Divider from "./components/data-display/divider";
|
|
15
|
+
import Paper from "./components/data-display/paper";
|
|
15
16
|
import SyntaxHighlighter from "./components/data-display/syntax-highlighter";
|
|
17
|
+
import Table from "./components/data-display/table";
|
|
18
|
+
import Typography from "./components/data-display/typography";
|
|
16
19
|
// Feedback
|
|
17
20
|
import Alert from "./components/feedback/alert";
|
|
21
|
+
import Modal from "./components/feedback/modal";
|
|
18
22
|
// Navigation
|
|
19
|
-
import
|
|
23
|
+
import MenuType from "./components/navigation/menu";
|
|
20
24
|
// Layout
|
|
21
25
|
import Grid from "./components/layout/grid-system";
|
|
22
26
|
import Layout from "./components/layout";
|
|
23
|
-
// Others
|
|
24
27
|
export {
|
|
25
28
|
// Form Elements
|
|
26
|
-
Button, ButtonGroup, Input, Select, Switch, Checkbox, Radio,
|
|
29
|
+
Button, ButtonGroup, Input, DatePicker, Select, Switch, Checkbox, Radio,
|
|
27
30
|
// Data Display
|
|
28
|
-
Card, Chip,
|
|
31
|
+
Card, Chip, Divider, Paper, SyntaxHighlighter, Table, Typography,
|
|
29
32
|
// Feedback
|
|
30
|
-
Alert,
|
|
33
|
+
Alert, Modal,
|
|
31
34
|
// Navigation
|
|
32
|
-
Menu,
|
|
35
|
+
MenuType as Menu,
|
|
33
36
|
// Layout
|
|
34
|
-
Grid, Layout,
|
|
35
|
-
// Others
|
|
36
|
-
SyntaxHighlighter, };
|
|
37
|
+
Grid, Layout, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ConfigOptions = {
|
|
3
|
+
layout: {
|
|
4
|
+
sider: {
|
|
5
|
+
left: {
|
|
6
|
+
element: React.ReactNode | null;
|
|
7
|
+
active: boolean;
|
|
8
|
+
};
|
|
9
|
+
right: {
|
|
10
|
+
element: React.ReactNode | null;
|
|
11
|
+
active: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
perPage: number;
|
|
16
|
+
};
|
|
17
|
+
type ConfigContextProps = {
|
|
18
|
+
config: ConfigOptions;
|
|
19
|
+
setConfig: React.Dispatch<React.SetStateAction<ConfigOptions>>;
|
|
20
|
+
};
|
|
21
|
+
type ConfigProviderProps = {
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export declare const ConfigContext: React.Context<ConfigContextProps>;
|
|
25
|
+
declare const ConfigProvider: ({ children }: ConfigProviderProps) => React.JSX.Element;
|
|
26
|
+
export { ConfigProvider };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { createContext, useState } from "react";
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
layout: {
|
|
5
|
+
sider: {
|
|
6
|
+
left: { element: null, active: true },
|
|
7
|
+
right: { element: null, active: true },
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
perPage: 5,
|
|
11
|
+
};
|
|
12
|
+
export const ConfigContext = createContext({
|
|
13
|
+
config: defaultOptions,
|
|
14
|
+
setConfig: () => { },
|
|
15
|
+
});
|
|
16
|
+
const ConfigProvider = ({ children }) => {
|
|
17
|
+
const [config, setConfig] = useState(defaultOptions);
|
|
18
|
+
return React.createElement(ConfigContext.Provider, { value: { config, setConfig } }, children);
|
|
19
|
+
};
|
|
20
|
+
export { ConfigProvider };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export type Status = "success" | "warning" | "information" | "error";
|
|
3
|
+
export type Direction = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
4
|
+
type Props = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
direction: Direction;
|
|
7
|
+
};
|
|
8
|
+
type NotificationContextProps = {
|
|
9
|
+
setTitle: React.Dispatch<React.SetStateAction<string>>;
|
|
10
|
+
setMessage: React.Dispatch<React.SetStateAction<string>>;
|
|
11
|
+
setStatus: React.Dispatch<React.SetStateAction<Status>>;
|
|
12
|
+
setTrigger: React.Dispatch<React.SetStateAction<boolean>>;
|
|
13
|
+
};
|
|
14
|
+
declare const NotificationContext: React.Context<Partial<NotificationContextProps>>;
|
|
15
|
+
declare const NotificationProvider: ({ children, direction }: Props) => React.JSX.Element;
|
|
16
|
+
export { NotificationContext, NotificationProvider };
|