ar-design 0.0.0 → 0.0.2
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/components/button/{type.d.ts → Types.d.ts} +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +8 -11
- package/dist/components/divider/index.d.ts +4 -0
- package/dist/components/divider/index.js +4 -0
- package/dist/components/menu/Types.d.ts +11 -0
- package/dist/components/menu/index.d.ts +5 -0
- package/dist/components/menu/index.js +57 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +6 -2
- package/dist/libs/styles/{theme.public.css → ar-core.css} +0 -28
- package/dist/libs/styles/button/button.css +0 -2
- package/dist/libs/styles/divider/core/core.css +4 -0
- package/dist/libs/styles/divider/divider.css +1 -0
- package/dist/libs/styles/menu/core/core.css +37 -0
- package/dist/libs/styles/menu/core/open-or-close.css +32 -0
- package/dist/libs/styles/menu/menu.css +1 -0
- package/dist/libs/types/Colors.js +1 -0
- package/package.json +1 -1
- /package/dist/components/button/{type.js → Types.js} +0 -0
- /package/dist/{libs/types/colors.js → components/menu/Types.js} +0 -0
- /package/dist/libs/types/{colors.d.ts → Colors.d.ts} +0 -0
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { __rest } from "tslib";
|
|
3
2
|
import React, { useRef } from "react";
|
|
4
3
|
import "../../libs/styles/button/button.css";
|
|
5
|
-
const Button = (
|
|
6
|
-
var { children, variant = "filled", shape, color = "primary", border, width = "auto", icon, upperCase } = _a, attributes = __rest(_a, ["children", "variant", "shape", "color", "border", "width", "icon", "upperCase"]);
|
|
4
|
+
const Button = ({ children, variant = "filled", shape, color = "primary", border, width = "auto", icon, upperCase, ...attributes }) => {
|
|
7
5
|
// refs
|
|
8
6
|
const _button = useRef(null);
|
|
9
7
|
// methods
|
|
10
8
|
const handleClassName = () => {
|
|
11
|
-
var _a;
|
|
12
9
|
let className = `ar-button-core ${variant} ${color} ${width}`;
|
|
13
10
|
if (shape)
|
|
14
11
|
className += ` ar-button-shape ${shape}`;
|
|
15
|
-
if (
|
|
16
|
-
if (border.style)
|
|
12
|
+
if (border) {
|
|
13
|
+
if (variant !== "filled" && border.style)
|
|
17
14
|
className += ` border-style-${border.style}`;
|
|
18
15
|
if (border.radius)
|
|
19
|
-
className += ` border-radius-${border
|
|
16
|
+
className += ` border-radius-${border?.radius}`;
|
|
20
17
|
}
|
|
21
18
|
if (icon) {
|
|
22
19
|
if (icon.element && !shape)
|
|
@@ -24,7 +21,7 @@ const Button = (_a) => {
|
|
|
24
21
|
if (icon.direction)
|
|
25
22
|
className += ` icon-${icon.direction}`;
|
|
26
23
|
if (icon.position)
|
|
27
|
-
className += ` icon-${
|
|
24
|
+
className += ` icon-${icon.direction ?? "row"}-${icon.position}`;
|
|
28
25
|
}
|
|
29
26
|
if (attributes.disabled)
|
|
30
27
|
className += ` disabled`;
|
|
@@ -32,7 +29,7 @@ const Button = (_a) => {
|
|
|
32
29
|
className += ` ${attributes.className}`;
|
|
33
30
|
return className;
|
|
34
31
|
};
|
|
35
|
-
return (React.createElement("button",
|
|
32
|
+
return (React.createElement("button", { ref: _button, ...attributes, className: handleClassName(), onClick: (event) => {
|
|
36
33
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
37
34
|
if (attributes.disabled)
|
|
38
35
|
return;
|
|
@@ -47,8 +44,8 @@ const Button = (_a) => {
|
|
|
47
44
|
}
|
|
48
45
|
})();
|
|
49
46
|
(() => attributes.onClick && attributes.onClick(event))();
|
|
50
|
-
} }
|
|
51
|
-
icon
|
|
47
|
+
} },
|
|
48
|
+
icon?.element,
|
|
52
49
|
typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
|
|
53
50
|
};
|
|
54
51
|
export default Button;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type MenuItemType = "group" | "divider" | "none";
|
|
3
|
+
export interface MenuProps {
|
|
4
|
+
render?: string | React.JSX.Element;
|
|
5
|
+
type?: MenuItemType;
|
|
6
|
+
icon?: React.JSX.Element;
|
|
7
|
+
submenu?: MenuProps[];
|
|
8
|
+
}
|
|
9
|
+
export type Props = {
|
|
10
|
+
data: MenuProps[];
|
|
11
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
|
+
import "../../libs/styles/menu/menu.css";
|
|
4
|
+
import Divider from "../divider";
|
|
5
|
+
const handleOnClick = (event, item) => {
|
|
6
|
+
event.stopPropagation();
|
|
7
|
+
if (item.type === "group")
|
|
8
|
+
return;
|
|
9
|
+
const _current = event.target;
|
|
10
|
+
const ulElement = _current.nextElementSibling;
|
|
11
|
+
if (_current && item.submenu && item.submenu.length > 0) {
|
|
12
|
+
_current.classList.toggle("ar-angle-down");
|
|
13
|
+
_current.classList.toggle("ar-angle-up");
|
|
14
|
+
}
|
|
15
|
+
if (ulElement)
|
|
16
|
+
ulElement.classList.toggle("opened");
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Alt menüleri sürekli olarak eklemek için özyinelemeli fonksiyon.
|
|
20
|
+
* @param item - Menü öğelerinin dizisi
|
|
21
|
+
* @param type - "group" | "divider" | "none" türlerinden birisi gönderilmelidir.
|
|
22
|
+
* @returns Menü yapısını temsil eden iç içe geçmiş liste
|
|
23
|
+
*/
|
|
24
|
+
const SubMenu = ({ items, type }) => {
|
|
25
|
+
if (!items)
|
|
26
|
+
return null;
|
|
27
|
+
// refs
|
|
28
|
+
let _className_ul = useRef("ar-menu-core-list-item-groups").current;
|
|
29
|
+
let _className_li = useRef("ar-menu-core-list-item-group-item").current;
|
|
30
|
+
let _className_groupTitle = useRef("ar-menu-core-list-item-group-item-title").current;
|
|
31
|
+
if (type === "group")
|
|
32
|
+
_className_ul += " opened";
|
|
33
|
+
return (React.createElement("ul", { className: _className_ul }, items.map((item, index) => {
|
|
34
|
+
if (item.submenu && item.submenu.length > 0) {
|
|
35
|
+
if (item.type !== "group")
|
|
36
|
+
_className_groupTitle += " ar-angle-down";
|
|
37
|
+
}
|
|
38
|
+
return (React.createElement("li", { key: index, className: _className_li, onClick: (event) => handleOnClick(event, item) },
|
|
39
|
+
React.createElement("div", { className: _className_groupTitle }, item.render),
|
|
40
|
+
React.createElement(SubMenu, { items: item.submenu, type: item.type })));
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
const Menu = ({ data, ...attributes }) => {
|
|
44
|
+
// refs
|
|
45
|
+
let _className_groupTitle = useRef("ar-menu-core-list-item-group-item-title").current;
|
|
46
|
+
return (React.createElement("nav", { className: "ar-menu-core", ...attributes },
|
|
47
|
+
React.createElement("ul", { className: "ar-menu-core-list" }, data.map((menuItem, index) => {
|
|
48
|
+
if (menuItem.submenu && menuItem.submenu.length > 0) {
|
|
49
|
+
if (menuItem.type !== "group")
|
|
50
|
+
_className_groupTitle += " ar-angle-down";
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement("li", { key: index, className: "ar-menu-core-list-item", onClick: (event) => handleOnClick(event, menuItem) },
|
|
53
|
+
menuItem.type === "divider" ? React.createElement(Divider, null) : React.createElement("div", { className: _className_groupTitle }, menuItem.render),
|
|
54
|
+
React.createElement(SubMenu, { items: menuItem.submenu })));
|
|
55
|
+
}))));
|
|
56
|
+
};
|
|
57
|
+
export default Menu;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import "./libs/styles/
|
|
2
|
-
import
|
|
1
|
+
import "./libs/styles/ar-core.css";
|
|
2
|
+
import Button from "./components/button";
|
|
3
3
|
export { Button };
|
|
4
|
+
import Divider from "./components/divider";
|
|
5
|
+
export { Divider };
|
|
6
|
+
import Menu from "./components/menu";
|
|
7
|
+
export { Menu };
|
|
8
|
+
import type { MenuProps } from "./components/menu/Types";
|
|
9
|
+
export type { MenuProps };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import "./libs/styles/
|
|
2
|
-
import
|
|
1
|
+
import "./libs/styles/ar-core.css";
|
|
2
|
+
import Button from "./components/button";
|
|
3
3
|
export { Button };
|
|
4
|
+
import Divider from "./components/divider";
|
|
5
|
+
export { Divider };
|
|
6
|
+
import Menu from "./components/menu";
|
|
7
|
+
export { Menu };
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/* #region General */
|
|
2
|
-
*,
|
|
3
|
-
*::before,
|
|
4
|
-
*::after {
|
|
5
|
-
margin: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
list-style-type: none;
|
|
9
|
-
font-size: 0.8rem;
|
|
10
|
-
outline: none;
|
|
11
|
-
letter-spacing: 0.5px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
html {
|
|
15
|
-
font-size: 1rem;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
body {
|
|
19
|
-
background-color: var(--pantone-black);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
a {
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
color: inherit;
|
|
25
|
-
}
|
|
26
|
-
/* #endregion */
|
|
27
|
-
/* General */
|
|
28
|
-
|
|
29
1
|
/* #region Color Palette */
|
|
30
2
|
:root {
|
|
31
3
|
--white: #fff;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url("./core/core.css");
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import url("./open-or-close.css");
|
|
2
|
+
|
|
3
|
+
.ar-menu-core {
|
|
4
|
+
background-color: var(--white);
|
|
5
|
+
}
|
|
6
|
+
.ar-menu-core ul {
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
list-style: none;
|
|
10
|
+
}
|
|
11
|
+
.ar-menu-core ul li {
|
|
12
|
+
padding: 0.75rem;
|
|
13
|
+
}
|
|
14
|
+
.ar-menu-core ul li:last-child {
|
|
15
|
+
padding-bottom: 0;
|
|
16
|
+
}
|
|
17
|
+
.ar-menu-core ul li ul {
|
|
18
|
+
margin-left: 0.25rem;
|
|
19
|
+
padding-left: 0.25rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ar-menu-core > .ar-menu-core-list {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
.ar-menu-core > .ar-menu-core-list > .ar-menu-core-list-item {
|
|
27
|
+
}
|
|
28
|
+
.ar-menu-core > .ar-menu-core-list > .ar-menu-core-list-item > .ar-menu-core-list-item-group-item-title {
|
|
29
|
+
}
|
|
30
|
+
.ar-menu-core > .ar-menu-core-list > .ar-menu-core-list-item > .ar-menu-core-list-item-groups {
|
|
31
|
+
}
|
|
32
|
+
.ar-menu-core
|
|
33
|
+
> .ar-menu-core-list
|
|
34
|
+
> .ar-menu-core-list-item
|
|
35
|
+
> .ar-menu-core-list-item-groups
|
|
36
|
+
> .ar-menu-core-list-item-group-item {
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.ar-menu-core ul li ul {
|
|
2
|
+
opacity: 0;
|
|
3
|
+
max-height: 0;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
transition: max-height 150ms ease-in-out, opacity 150ms ease-in-out;
|
|
6
|
+
}
|
|
7
|
+
.ar-menu-core .ar-menu-core-list-item-groups.opened {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
max-height: 100rem;
|
|
10
|
+
}
|
|
11
|
+
.ar-menu-core .ar-menu-core-list-item-group-item-title {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.ar-menu-core .ar-menu-core-list-item-group-item-title:is(.ar-angle-down, .ar-angle-up)::after {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
position: relative;
|
|
18
|
+
top: -1.5px;
|
|
19
|
+
content: "";
|
|
20
|
+
width: 0.25rem;
|
|
21
|
+
height: 0.25rem;
|
|
22
|
+
margin-left: 0.5rem;
|
|
23
|
+
border: solid 2px transparent;
|
|
24
|
+
border-right-color: red;
|
|
25
|
+
border-bottom-color: red;
|
|
26
|
+
transform-origin: center;
|
|
27
|
+
transform: rotate(45deg);
|
|
28
|
+
transition: transform 250ms ease-in-out;
|
|
29
|
+
}
|
|
30
|
+
.ar-menu-core .ar-menu-core-list-item-group-item-title.ar-angle-up::after {
|
|
31
|
+
transform: rotate(585deg);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url("./core/core.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|