ar-design 0.1.15 → 0.1.17
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/syntax-highlighter/syntax-highlighter.css +6 -6
- package/dist/assets/css/components/feedback/alert/alert.css +0 -1
- package/dist/assets/css/components/feedback/alert/core/color.css +8 -4
- package/dist/assets/css/components/form/button-group/button-group.css +6 -3
- package/dist/assets/css/components/form/input/input.css +0 -1
- package/dist/assets/css/components/layout/layout.css +1 -1
- package/dist/assets/css/core/ar-core.css +1 -1
- package/dist/components/data-display/card/IProps.d.ts +5 -0
- package/dist/components/data-display/card/index.d.ts +2 -2
- package/dist/components/data-display/card/index.js +2 -2
- package/dist/components/data-display/chip/IProps.d.ts +5 -0
- package/dist/components/data-display/chip/index.d.ts +2 -2
- package/dist/components/data-display/chip/index.js +5 -5
- package/dist/components/data-display/typography/index.d.ts +2 -2
- package/dist/components/data-display/typography/paragraph/IProps.d.ts +7 -0
- package/dist/components/data-display/typography/paragraph/Paragraph.d.ts +2 -2
- package/dist/components/data-display/typography/paragraph/Paragraph.js +1 -1
- package/dist/components/data-display/typography/title/{Types.d.ts → IProps.d.ts} +4 -4
- package/dist/components/data-display/typography/title/Title.d.ts +2 -2
- package/dist/components/data-display/typography/title/Title.js +1 -1
- package/dist/components/feedback/alert/IProps.d.ts +7 -0
- package/dist/components/feedback/alert/index.d.ts +2 -2
- package/dist/components/feedback/alert/index.js +10 -12
- package/dist/components/form/button/IProps.d.ts +24 -0
- package/dist/components/form/button/index.d.ts +2 -2
- package/dist/components/form/button/index.js +2 -2
- package/dist/components/form/button-group/index.js +1 -1
- package/dist/components/form/checkbox/IProps.d.ts +6 -0
- package/dist/components/form/checkbox/index.d.ts +2 -2
- package/dist/components/form/checkbox/index.js +3 -3
- package/dist/components/form/input/IProps.d.ts +13 -0
- package/dist/components/form/input/index.d.ts +2 -17
- package/dist/components/form/input/index.js +11 -11
- package/dist/components/form/radio/IProps.d.ts +6 -0
- package/dist/components/form/radio/index.d.ts +2 -2
- package/dist/components/form/select/Props.d.ts +25 -0
- package/dist/components/form/select/index.d.ts +1 -1
- package/dist/components/form/select/index.js +6 -6
- package/dist/components/form/switch/IProps.d.ts +5 -0
- package/dist/components/form/switch/index.d.ts +2 -2
- package/dist/components/form/switch/index.js +1 -1
- package/dist/components/layout/Header.d.ts +2 -2
- package/dist/components/layout/IProps.d.ts +13 -0
- package/dist/components/layout/LSider.d.ts +1 -2
- package/dist/components/layout/LSider.js +1 -1
- package/dist/components/layout/Main.d.ts +2 -2
- package/dist/components/layout/RSider.d.ts +1 -2
- package/dist/components/layout/RSider.js +1 -1
- package/dist/components/layout/Section.d.ts +2 -2
- package/dist/components/layout/index.d.ts +7 -7
- package/dist/components/navigation/menu/Types.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/libs/core/application/hooks/{useLayout.d.ts → index.d.ts} +1 -2
- package/dist/libs/core/application/hooks/{useLayout.js → index.js} +1 -2
- package/dist/libs/types/IGlobalProps.d.ts +121 -0
- package/dist/libs/types/index.d.ts +10 -5
- package/dist/libs/types/index.js +2 -0
- package/package.json +9 -3
- package/dist/components/data-display/card/Types.d.ts +0 -4
- package/dist/components/data-display/chip/Types.d.ts +0 -12
- package/dist/components/data-display/typography/paragraph/Types.d.ts +0 -9
- package/dist/components/feedback/alert/Types.d.ts +0 -9
- package/dist/components/form/button/Types.d.ts +0 -146
- package/dist/components/form/checkbox/Types.d.ts +0 -12
- package/dist/components/form/input/Types.d.ts +0 -23
- package/dist/components/form/radio/Types.d.ts +0 -9
- package/dist/components/form/select/Types.d.ts +0 -35
- package/dist/components/form/switch/Types.d.ts +0 -8
- package/dist/components/layout/Types.d.ts +0 -15
- package/dist/libs/types/BorderRadiuses.d.ts +0 -1
- package/dist/libs/types/Colors.d.ts +0 -1
- package/dist/libs/types/Colors.js +0 -1
- package/dist/libs/types/Variants.d.ts +0 -2
- package/dist/libs/types/Variants.js +0 -1
- /package/dist/components/data-display/card/{Types.js → IProps.js} +0 -0
- /package/dist/components/data-display/chip/{Types.js → IProps.js} +0 -0
- /package/dist/components/data-display/typography/paragraph/{Types.js → IProps.js} +0 -0
- /package/dist/components/data-display/typography/title/{Types.js → IProps.js} +0 -0
- /package/dist/components/feedback/alert/{Types.js → IProps.js} +0 -0
- /package/dist/components/form/button/{Types.js → IProps.js} +0 -0
- /package/dist/components/form/checkbox/{Types.js → IProps.js} +0 -0
- /package/dist/components/form/input/{Types.js → IProps.js} +0 -0
- /package/dist/components/form/radio/{Types.js → IProps.js} +0 -0
- /package/dist/components/form/select/{Types.js → Props.js} +0 -0
- /package/dist/components/form/switch/{Types.js → IProps.js} +0 -0
- /package/dist/components/layout/{Types.js → IProps.js} +0 -0
- /package/dist/libs/types/{BorderRadiuses.js → IGlobalProps.js} +0 -0
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
.ar-syntax {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
background-color: var(--gray-200);
|
|
5
|
-
/* border: solid 1px var(--gray-200); */
|
|
6
4
|
border-radius: var(--border-radius-lg);
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
.ar-syntax > .preview {
|
|
10
8
|
position: relative;
|
|
11
9
|
gap: 1rem;
|
|
12
|
-
|
|
10
|
+
border: solid 1px var(--gray-200);
|
|
11
|
+
border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
|
|
13
12
|
padding: 1rem;
|
|
14
|
-
border-radius: var(--border-radius-lg);
|
|
15
13
|
}
|
|
16
14
|
.ar-syntax > .preview.left {
|
|
17
15
|
justify-content: left;
|
|
@@ -36,10 +34,10 @@
|
|
|
36
34
|
.ar-syntax > .pre {
|
|
37
35
|
background-color: var(--gray-900);
|
|
38
36
|
margin: 0;
|
|
39
|
-
|
|
37
|
+
|
|
40
38
|
border-top: solid 2.5px var(--custom-tag-color);
|
|
41
39
|
border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
|
|
42
|
-
overflow
|
|
40
|
+
overflow: hidden;
|
|
43
41
|
}
|
|
44
42
|
.ar-syntax > .pre.hidden {
|
|
45
43
|
display: none;
|
|
@@ -51,8 +49,10 @@
|
|
|
51
49
|
display: flex;
|
|
52
50
|
flex-direction: column;
|
|
53
51
|
gap: 0.5rem 0;
|
|
52
|
+
padding: 1rem;
|
|
54
53
|
font-family: var(--jetBrainsMonoRegular) !important;
|
|
55
54
|
font-size: 0.9rem;
|
|
55
|
+
overflow-x: auto;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
@import url("./core/jsx.template.css");
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
.ar-alert.primary {
|
|
2
2
|
background-color: rgba(var(--primary-rgb), 0.1);
|
|
3
|
+
border-color: rgba(var(--primary-rgb), 0.5);
|
|
3
4
|
}
|
|
4
5
|
.ar-alert.secondary {
|
|
5
6
|
background-color: rgba(var(--secondary-rgb), 0.1);
|
|
7
|
+
border-color: rgba(var(--secondary-rgb), 0.5);
|
|
6
8
|
}
|
|
7
9
|
.ar-alert.success {
|
|
8
10
|
background-color: rgba(var(--success-rgb), 0.1);
|
|
11
|
+
border-color: rgba(var(--success-rgb), 0.5);
|
|
9
12
|
}
|
|
10
13
|
.ar-alert.warning {
|
|
11
14
|
background-color: rgba(var(--warning-rgb), 0.1);
|
|
15
|
+
border-color: rgba(var(--warning-rgb), 0.5);
|
|
12
16
|
}
|
|
13
17
|
.ar-alert.danger {
|
|
14
18
|
background-color: rgba(var(--danger-rgb), 0.1);
|
|
19
|
+
border-color: rgba(var(--danger-rgb), 0.5);
|
|
15
20
|
}
|
|
16
21
|
.ar-alert.information {
|
|
17
22
|
background-color: rgba(var(--information-rgb), 0.1);
|
|
23
|
+
border-color: rgba(var(--information-rgb), 0.5);
|
|
18
24
|
}
|
|
19
25
|
.ar-alert.light {
|
|
20
26
|
background-color: rgba(var(--light-rgb), 0.1);
|
|
27
|
+
border-color: rgba(var(--light-rgb), 0.5);
|
|
21
28
|
}
|
|
22
29
|
.ar-alert.dark {
|
|
23
30
|
background-color: rgba(var(--dark-rgb), 0.1);
|
|
24
|
-
|
|
25
|
-
.ar-alert.transparent {
|
|
26
|
-
background-color: transparent;
|
|
27
|
-
padding: 0 !important;
|
|
31
|
+
border-color: rgba(var(--dark-rgb), 0.5);
|
|
28
32
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
.ar-button-group > .ar-button
|
|
1
|
+
.ar-button-group > .ar-button,
|
|
2
|
+
.ar-button-group > .ar-button:is(.ar-button-shape) {
|
|
2
3
|
border-radius: 0;
|
|
3
4
|
}
|
|
4
|
-
.ar-button-group > .ar-button:first-child
|
|
5
|
+
.ar-button-group > .ar-button:first-child,
|
|
6
|
+
.ar-button-group > .ar-button:is(.ar-button-shape):first-child {
|
|
5
7
|
border-top-left-radius: var(--border-radius-sm);
|
|
6
8
|
border-bottom-left-radius: var(--border-radius-sm);
|
|
7
9
|
}
|
|
8
|
-
.ar-button-group > .ar-button:last-child
|
|
10
|
+
.ar-button-group > .ar-button:last-child,
|
|
11
|
+
.ar-button-group > .ar-button:is(.ar-button-shape):last-child {
|
|
9
12
|
border-top-right-radius: var(--border-radius-sm);
|
|
10
13
|
border-bottom-right-radius: var(--border-radius-sm);
|
|
11
14
|
}
|
|
@@ -2,10 +2,10 @@ 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 = "" }) => {
|
|
6
6
|
return (React.createElement("div", { className: "ar-card" },
|
|
7
7
|
React.createElement("div", { className: "title" },
|
|
8
|
-
React.createElement(Title, { Level: "h4" }, title
|
|
8
|
+
React.createElement(Title, { Level: "h4" }, title)),
|
|
9
9
|
React.createElement("div", { className: "content" }, children)));
|
|
10
10
|
};
|
|
11
11
|
export default Card;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/data-display/chip/chip.css";
|
|
4
|
-
const Chip = ({ variant = "outlined",
|
|
4
|
+
const Chip = ({ variant = "outlined", status = "primary", border = { radius: "sm" }, text, }) => {
|
|
5
5
|
let _className = useRef("ar-chip").current;
|
|
6
6
|
// input className
|
|
7
7
|
if (variant)
|
|
8
8
|
_className += ` ${variant}`;
|
|
9
|
-
if (
|
|
10
|
-
_className += ` ${
|
|
9
|
+
if (status)
|
|
10
|
+
_className += ` ${status}`;
|
|
11
11
|
// border
|
|
12
|
-
_className += ` border-style
|
|
13
|
-
_className += ` border-radius-${border
|
|
12
|
+
_className += ` border-style-solid`;
|
|
13
|
+
_className += ` border-radius-${border.radius}`;
|
|
14
14
|
return React.createElement("span", { className: _className }, text);
|
|
15
15
|
};
|
|
16
16
|
export default Chip;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../assets/css/components/data-display/typography/typography.css";
|
|
2
2
|
declare const Typography: {
|
|
3
|
-
Title: import("react").FC<import("./title/
|
|
4
|
-
Paragraph: import("react").FC<import("./paragraph/
|
|
3
|
+
Title: import("react").FC<import("./title/IProps").default>;
|
|
4
|
+
Paragraph: import("react").FC<import("./paragraph/IProps").default>;
|
|
5
5
|
};
|
|
6
6
|
export default Typography;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParagraphColors, Status } from "../../../../libs/types";
|
|
2
|
+
import { IGlobalProps } from "../../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IProps extends Omit<IGlobalProps, "status"> {
|
|
4
|
+
color?: ParagraphColors | Status;
|
|
5
|
+
align?: "left" | "center" | "right";
|
|
6
|
+
}
|
|
7
|
+
export default IProps;
|
|
@@ -9,7 +9,7 @@ const Paragraph = ({ children, color, align = "left", size, upperCase = false, }
|
|
|
9
9
|
_className += ` ${color}`;
|
|
10
10
|
if (size)
|
|
11
11
|
_className += ` ${size}`;
|
|
12
|
-
return React.createElement("p", { className: _className }, upperCase ? children.toLocaleUpperCase() : children);
|
|
12
|
+
return (React.createElement("p", { className: _className }, typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
|
|
13
13
|
};
|
|
14
14
|
Paragraph.displayName = "Paragraph";
|
|
15
15
|
export default Paragraph;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IGlobalProps } from "../../../../libs/types/IGlobalProps";
|
|
2
|
+
interface IProps extends Omit<IGlobalProps, "size"> {
|
|
3
3
|
Level: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
4
|
align?: "left" | "center" | "right";
|
|
5
5
|
size?: "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large" | "xxx-large" | "smaller" | "larger";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
}
|
|
7
|
+
export default IProps;
|
|
@@ -7,7 +7,7 @@ const Title = ({ children, Level, align = "left", size, upperCase = false }) =>
|
|
|
7
7
|
_className += ` ${align}`;
|
|
8
8
|
if (size)
|
|
9
9
|
_className += ` ${size}`;
|
|
10
|
-
return (React.createElement(Level, { className: _className }, upperCase ? children.toLocaleUpperCase() : children));
|
|
10
|
+
return (React.createElement(Level, { className: _className }, typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
|
|
11
11
|
};
|
|
12
12
|
Title.displayName = "Title";
|
|
13
13
|
export default Title;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import "../../../assets/css/components/feedback/alert/alert.css";
|
|
4
|
-
const Alert = ({ message,
|
|
4
|
+
const Alert = ({ children, message, status = "primary", border = { radius: "sm" }, emphasize, }) => {
|
|
5
5
|
// refs
|
|
6
|
-
let _className =
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return _className;
|
|
14
|
-
};
|
|
6
|
+
let _className = "ar-alert";
|
|
7
|
+
// status
|
|
8
|
+
if (status)
|
|
9
|
+
_className += ` ${status}`;
|
|
10
|
+
// border
|
|
11
|
+
_className += ` border-style-solid`;
|
|
12
|
+
_className += ` border-radius-${border.radius}`;
|
|
15
13
|
const formattedTags = (message) => {
|
|
16
14
|
// TODO: Şuan için sadece transparent olan alert tiplerinde çalışmakta.
|
|
17
15
|
// TODO: Bu konu hakkında düşünüp karar verilecek.
|
|
@@ -55,6 +53,6 @@ const Alert = ({ message, type, border = true, emphasize }) => {
|
|
|
55
53
|
* @returns
|
|
56
54
|
*/
|
|
57
55
|
const cleanMessage = (message) => message.replace(/<\/?[^>]+>/g, "");
|
|
58
|
-
return (React.createElement("div", { className:
|
|
56
|
+
return (React.createElement("div", { className: _className }, message ? (Array.isArray(message) ? (createList(message)) : (React.createElement("p", { dangerouslySetInnerHTML: { __html: formattedTags(cleanMessage(message)) ?? "" } }))) : (children)));
|
|
59
57
|
};
|
|
60
58
|
export default Alert;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
2
|
+
interface IProps extends Omit<IGlobalProps, "children">, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Bileşenin şekil varyantını belirtir ve genellikle sadece ikon için kullanılmalıdır.
|
|
5
|
+
* İki seçenekten biri olabilir: "circle" veya "square".
|
|
6
|
+
*
|
|
7
|
+
* - `"circle"`: Daire şeklinde stilize edilmiş bir varyant.
|
|
8
|
+
* - `"square"`: Kare şeklinde stilize edilmiş bir varyant.
|
|
9
|
+
*
|
|
10
|
+
* Bu seçenekler, bileşenin şekilsel görünümünü değiştirir.
|
|
11
|
+
*
|
|
12
|
+
* Örneğin;
|
|
13
|
+
*
|
|
14
|
+
* ```jsx
|
|
15
|
+
* <Button shape="circle">Hello, World!</Button>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
shape?: "circle" | "square";
|
|
19
|
+
position?: {
|
|
20
|
+
type: "fixed" | "absolute";
|
|
21
|
+
inset: ("top" | "right" | "bottom" | "left")[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default IProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Props } from "./Types";
|
|
3
2
|
import "../../../assets/css/components/form/button/button.css";
|
|
4
|
-
|
|
3
|
+
import IProps from "./IProps";
|
|
4
|
+
declare const Button: React.FC<IProps>;
|
|
5
5
|
export default Button;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/button/button.css";
|
|
4
|
-
const Button = ({ children, variant = "filled", shape,
|
|
4
|
+
const Button = ({ children, variant = "filled", shape, status = "primary", border, size = "normal", position, icon, upperCase, ...attributes }) => {
|
|
5
5
|
// refs
|
|
6
6
|
const _button = useRef(null);
|
|
7
|
-
let _buttonClassName = `ar-button ${variant} ${
|
|
7
|
+
let _buttonClassName = `ar-button ${variant} ${status}`;
|
|
8
8
|
let _spanClassName = `text`;
|
|
9
9
|
// button className
|
|
10
10
|
if (shape)
|
|
@@ -25,7 +25,7 @@ const ButtonGroup = ({ children }) => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}, [children]); // children değişirse kontrolü tekrar yap
|
|
28
|
-
return (React.createElement("div", { className: "ar-button-group" }, error ? React.createElement(Alert, {
|
|
28
|
+
return (React.createElement("div", { className: "ar-button-group" }, error ? React.createElement(Alert, { status: "danger", message: error }) : children));
|
|
29
29
|
};
|
|
30
30
|
ButtonGroup.displayName = "ButtonGroup";
|
|
31
31
|
export default ButtonGroup;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IProps extends Omit<IGlobalProps, "children">, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export default IProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import IProps from "./IProps";
|
|
3
3
|
import "../../../assets/css/components/form/checkbox/checkbox.css";
|
|
4
|
-
declare const Checkbox: React.FC<
|
|
4
|
+
declare const Checkbox: React.FC<IProps>;
|
|
5
5
|
export default Checkbox;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/checkbox/checkbox.css";
|
|
4
|
-
const Checkbox = ({ label, variant = "outlined", status = "primary", border, ...attributes }) => {
|
|
4
|
+
const Checkbox = ({ label, variant = "outlined", status = "primary", border = { radius: "sm" }, ...attributes }) => {
|
|
5
5
|
// refs
|
|
6
6
|
let _checkbox = useRef(null);
|
|
7
7
|
let _wrapperClassName = "ar-checkbox-wrapper";
|
|
@@ -13,10 +13,10 @@ const Checkbox = ({ label, variant = "outlined", status = "primary", border, ...
|
|
|
13
13
|
_checkboxClassName += ` light`;
|
|
14
14
|
// border
|
|
15
15
|
_checkboxClassName += ` border-style-solid`;
|
|
16
|
-
_checkboxClassName += ` border-radius-${border
|
|
16
|
+
_checkboxClassName += ` border-radius-${border.radius}`;
|
|
17
17
|
return (React.createElement("div", { className: _wrapperClassName },
|
|
18
18
|
React.createElement("label", null,
|
|
19
|
-
React.createElement("input", { type: attributes.type || "checkbox", ...attributes, onChange: (event) => {
|
|
19
|
+
React.createElement("input", { type: attributes.type || "checkbox", ...attributes, size: 0, onChange: (event) => {
|
|
20
20
|
(() => {
|
|
21
21
|
const _current = _checkbox.current;
|
|
22
22
|
if (!_current)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import IButtonProps from "../button/IProps";
|
|
3
|
+
import { Variants } from "../../../libs/types";
|
|
4
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
5
|
+
interface IProps extends Omit<IGlobalProps, "children">, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
|
|
6
|
+
button?: IButtonProps;
|
|
7
|
+
addon?: {
|
|
8
|
+
variant?: Variants;
|
|
9
|
+
before?: string | number;
|
|
10
|
+
after?: string | number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export default IProps;
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "../../../assets/css/components/form/input/input.css";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
status?: import("../../../libs/types").Colors;
|
|
6
|
-
icon?: {
|
|
7
|
-
element: React.JSX.Element;
|
|
8
|
-
position?: "start" | "end";
|
|
9
|
-
};
|
|
10
|
-
border?: {
|
|
11
|
-
radius: import("../../../libs/types").BorderRadiuses;
|
|
12
|
-
};
|
|
13
|
-
button?: import("../button/Types").Props;
|
|
14
|
-
addon?: {
|
|
15
|
-
variant?: import("../../../libs/types").Variants;
|
|
16
|
-
before?: string | number;
|
|
17
|
-
after?: string | number;
|
|
18
|
-
};
|
|
19
|
-
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
3
|
+
import IProps from "./IProps";
|
|
4
|
+
declare const Input: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLInputElement>>;
|
|
20
5
|
export default Input;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import "../../../assets/css/components/form/input/input.css";
|
|
4
4
|
import Button from "../button";
|
|
5
|
-
const Input = forwardRef(({ variant = "outlined", status = "light", icon, border, button, addon, ...attributes }, ref) => {
|
|
6
|
-
//
|
|
7
|
-
let _wrapperClassName =
|
|
8
|
-
let _addonBeforeClassName =
|
|
9
|
-
let _addonAfterClassName =
|
|
10
|
-
let _inputWrapperClassName =
|
|
11
|
-
let _inputClassName =
|
|
5
|
+
const Input = forwardRef(({ variant = "outlined", status = "light", icon, border = { radius: "sm" }, button, addon, ...attributes }, ref) => {
|
|
6
|
+
// variables
|
|
7
|
+
let _wrapperClassName = "ar-input-wrapper";
|
|
8
|
+
let _addonBeforeClassName = "addon-before";
|
|
9
|
+
let _addonAfterClassName = "addon-after";
|
|
10
|
+
let _inputWrapperClassName = "ar-input";
|
|
11
|
+
let _inputClassName = "";
|
|
12
12
|
// input wrapper className
|
|
13
13
|
if (icon && icon.element) {
|
|
14
14
|
_inputWrapperClassName += ` icon`;
|
|
@@ -20,7 +20,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", icon, border
|
|
|
20
20
|
if (status)
|
|
21
21
|
_inputClassName += ` ${status}`;
|
|
22
22
|
// border radius
|
|
23
|
-
_inputClassName += ` border-radius-${border
|
|
23
|
+
_inputClassName += ` border-radius-${border.radius}`;
|
|
24
24
|
// addon className
|
|
25
25
|
if (addon) {
|
|
26
26
|
_wrapperClassName += ` addon`;
|
|
@@ -40,7 +40,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", icon, border
|
|
|
40
40
|
addon?.before && React.createElement("span", { className: _addonBeforeClassName }, addon?.before),
|
|
41
41
|
React.createElement("div", { className: _inputWrapperClassName },
|
|
42
42
|
icon?.element && React.createElement("span", { className: "icon-element" }, icon.element),
|
|
43
|
-
React.createElement("input", { ref: ref, ...attributes, className: _inputClassName, onChange: (event) => {
|
|
43
|
+
React.createElement("input", { ref: ref, ...attributes, size: 20, className: _inputClassName, onChange: (event) => {
|
|
44
44
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
45
45
|
if (attributes.disabled)
|
|
46
46
|
return;
|
|
@@ -58,7 +58,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", icon, border
|
|
|
58
58
|
})();
|
|
59
59
|
} })),
|
|
60
60
|
addon?.after && React.createElement("span", { className: _addonAfterClassName }, addon?.after),
|
|
61
|
-
button && (React.createElement(Button, { ...button,
|
|
61
|
+
button && (React.createElement(Button, { ...button, status: status, border: { radius: border.radius }, disabled: attributes.disabled }))));
|
|
62
62
|
});
|
|
63
63
|
Input.displayName = "Input";
|
|
64
64
|
export default Input;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IProps extends Omit<IGlobalProps, "children">, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export default IProps;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Status, Variants, Option } from "../../../libs/types";
|
|
2
|
+
import { IGlobalProps } from "../../../libs/types/IGlobalProps";
|
|
3
|
+
interface IMultiple {
|
|
4
|
+
status?: {
|
|
5
|
+
color?: Status;
|
|
6
|
+
selected?: {
|
|
7
|
+
variant?: Variants;
|
|
8
|
+
color?: Status;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
defaultValueIndex?: number[];
|
|
12
|
+
onChange: (option: Option[]) => void;
|
|
13
|
+
multiple: true;
|
|
14
|
+
}
|
|
15
|
+
interface ISingle {
|
|
16
|
+
status?: Status;
|
|
17
|
+
defaultValueIndex?: number;
|
|
18
|
+
onChange: (option: Option | undefined) => void;
|
|
19
|
+
multiple?: false;
|
|
20
|
+
}
|
|
21
|
+
export type Props = {
|
|
22
|
+
options: Option[];
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
} & (IMultiple | ISingle) & Omit<IGlobalProps, "children">;
|
|
25
|
+
export {};
|
|
@@ -5,7 +5,7 @@ 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,
|
|
8
|
+
const Select = ({ variant = "outlined", status, border, options, onChange, multiple, defaultValueIndex, ...attributes }) => {
|
|
9
9
|
// refs
|
|
10
10
|
let _selectionClassName = useRef("selections").current;
|
|
11
11
|
const _arSelect = useRef(null);
|
|
@@ -129,7 +129,7 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
129
129
|
if (!multiple) {
|
|
130
130
|
if (_singleInput.current) {
|
|
131
131
|
_singleInput.current.value = "";
|
|
132
|
-
_singleInput.current.placeholder = selection?.text || placeholder || "";
|
|
132
|
+
_singleInput.current.placeholder = selection?.text || attributes.placeholder || "";
|
|
133
133
|
}
|
|
134
134
|
optionItems[_selectedItemIndex.current].scrollIntoView({
|
|
135
135
|
behavior: "smooth",
|
|
@@ -160,7 +160,7 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
160
160
|
else {
|
|
161
161
|
if (_singleInput.current) {
|
|
162
162
|
_singleInput.current.value = selection?.text || "";
|
|
163
|
-
_singleInput.current.placeholder = placeholder || "";
|
|
163
|
+
_singleInput.current.placeholder = attributes.placeholder || "";
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
setOptionsClassName((prev) => [...prev, direction, "closed"]);
|
|
@@ -209,15 +209,15 @@ const Select = ({ variant = "outlined", status, border, options, onChange, multi
|
|
|
209
209
|
return (React.createElement("div", { ref: _arSelect, className: "ar-select-wrapper" },
|
|
210
210
|
React.createElement("div", { ref: _multipleInput, className: "ar-select" },
|
|
211
211
|
multiple ? (React.createElement("div", { className: _selectionClassName, onClick: () => setOptionsOpen((x) => !x) },
|
|
212
|
-
React.createElement("div", { className: "items" }, selections.length > 0 ? (selections.map((selection, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled",
|
|
212
|
+
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
213
|
// Single
|
|
214
214
|
React.createElement(Input, { ref: _singleInput, variant: variant, status: status || "light", onClick: () => setOptionsOpen((x) => !x), onChange: () => !optionsOpen && setOptionsOpen(true), onKeyUp: (event) => {
|
|
215
215
|
if (event.key === "Enter")
|
|
216
216
|
return;
|
|
217
217
|
// Arama yapmak için kullanılan state bu kısımda dolduruluyor.
|
|
218
218
|
setSearchText(event.currentTarget.value);
|
|
219
|
-
}, placeholder: placeholder, disabled: disabled })),
|
|
220
|
-
!disabled &&
|
|
219
|
+
}, placeholder: attributes.placeholder, disabled: attributes.disabled })),
|
|
220
|
+
!attributes.disabled &&
|
|
221
221
|
(Object.keys(selection || {}).length > 0 || (multiple && selections.length > 0)) && (React.createElement("span", { className: "button-clear", onClick: () => {
|
|
222
222
|
// Multiple
|
|
223
223
|
if (multiple) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Props } from "./Types";
|
|
3
2
|
import "../../../assets/css/components/form/switch/switch.css";
|
|
4
|
-
|
|
3
|
+
import IProps from "./IProps";
|
|
4
|
+
declare const Switch: React.FC<IProps>;
|
|
5
5
|
export default Switch;
|