@ayseaistudio/ui-components 2.0.0 → 2.1.1

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/README.md CHANGED
@@ -19,7 +19,9 @@ If you encounter a React version conflict, use:
19
19
  npm install @ayseaistudio/ui-components --legacy-peer-deps
20
20
  ```
21
21
 
22
- ---
22
+ ```bash
23
+ npm list @ayseaistudio/ui-components
24
+ ```
23
25
 
24
26
  ## 🛠️ Development & Publishing Workflow
25
27
 
@@ -24,9 +24,11 @@ interface Props {
24
24
  onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
25
25
  onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
26
26
  onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
27
+ selectFromPopup?: boolean;
28
+ onRequestPopupOpen?: (anchorEl: HTMLElement | null) => void;
27
29
  }
28
30
  export declare const InputField: {
29
- ({ withAlertIcon, withAlertMessage, leftIcon, rightIcon, defaultValue, alertText, clearable, text, headerText, withHeader, size, status, radius, className, frameClassName, isPassword, value, onChange, onClear, onFocus, onBlur, onKeyDown, }: Props): React.JSX.Element;
31
+ ({ withAlertIcon, withAlertMessage, leftIcon, rightIcon, defaultValue, alertText, clearable, text, headerText, withHeader, size, status, radius, className, frameClassName, isPassword, value, onChange, onClear, onFocus, onBlur, onKeyDown, selectFromPopup, onRequestPopupOpen, }: Props): React.JSX.Element;
30
32
  propTypes: {
31
33
  withAlertIcon: PropTypes.Requireable<boolean>;
32
34
  withAlertMessage: PropTypes.Requireable<boolean>;
@@ -51,6 +53,8 @@ export declare const InputField: {
51
53
  onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
52
54
  clearable: PropTypes.Requireable<boolean>;
53
55
  onClear: PropTypes.Requireable<(...args: any[]) => any>;
56
+ selectFromPopup: PropTypes.Requireable<boolean>;
57
+ onRequestPopupOpen: PropTypes.Requireable<(...args: any[]) => any>;
54
58
  };
55
59
  };
56
60
  export {};
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import PropTypes from "prop-types";
3
- import React, { useReducer, useState } from "react";
3
+ import React, { useReducer, useRef, useState } from "react";
4
4
  import "./style.css";
5
5
  import { IconEyeOff, IconEye, IconX, IconAlertSquareRounded } from "@tabler/icons-react";
6
6
  const initialState = (size, status, radius) => ({
@@ -21,13 +21,18 @@ const reducer = (state, action) => {
21
21
  return state;
22
22
  }
23
23
  };
24
- export const InputField = ({ withAlertIcon = true, withAlertMessage = true, leftIcon, rightIcon, defaultValue = "", alertText = "Doldurulması zorunlu alan.", clearable = false, text = "Placeholder", headerText = "Label", withHeader = true, size = "large", status = "default", radius = "small", className, frameClassName, isPassword = false, value, onChange, onClear, onFocus, onBlur, onKeyDown, }) => {
24
+ export const InputField = ({ withAlertIcon = true, withAlertMessage = true, leftIcon, rightIcon, defaultValue = "", alertText = "Doldurulması zorunlu alan.", clearable = false, text = "Placeholder", headerText = "Label", withHeader = true, size = "large", status = "default", radius = "small", className, frameClassName, isPassword = false, value, onChange, onClear, onFocus, onBlur, onKeyDown, selectFromPopup = false, onRequestPopupOpen, }) => {
25
25
  const [state, dispatch] = useReducer(reducer, initialState(size, status, radius));
26
26
  const [inputValue, setInputValue] = useState(defaultValue);
27
27
  const [isPasswordVisible, setIsPasswordVisible] = useState(false);
28
+ const containerRef = useRef(null);
28
29
  const isControlled = value !== undefined;
29
30
  const handleInputChange = (event) => {
30
31
  const newValue = event.target.value;
32
+ if (selectFromPopup) {
33
+ // typing is disabled in select-from-popup mode
34
+ return;
35
+ }
31
36
  if (isControlled) {
32
37
  onChange?.(event);
33
38
  }
@@ -44,7 +49,13 @@ export const InputField = ({ withAlertIcon = true, withAlertMessage = true, left
44
49
  setInputValue("");
45
50
  }
46
51
  };
47
- return (_jsxs("div", { className: `input-field size-2-${state.size} ${className}`, onMouseLeave: () => dispatch("mouse_leave"), onMouseEnter: () => dispatch("mouse_enter"), onClick: () => dispatch("click"), children: [withHeader && (_jsx("div", { className: `frame ${["active", "default", "disabled", "hover"].includes(state.status) ? frameClassName : ""}`, children: _jsx("div", { className: `label-2 ${state.status}`, children: headerText }) })), _jsxs("div", { className: `input-fields size-4-${state.size} status-0-${state.status}`, children: [leftIcon && React.cloneElement(leftIcon, { color: state.status === "alert" ? "#FF6983" : "#888888" }), _jsx("input", { type: isPassword ? (isPasswordVisible ? "text" : "password") : "text", placeholder: text, value: currentValue, onChange: handleInputChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, className: `input-field-placeholder ${state.status === "alert" ? "alert" : ""}`, style: {
52
+ const toggleDropdown = () => {
53
+ if (!selectFromPopup)
54
+ return;
55
+ onRequestPopupOpen?.(containerRef.current);
56
+ };
57
+ // selection is handled by parent when using external popup
58
+ return (_jsxs("div", { className: `input-field size-2-${state.size} ${className}`, ref: containerRef, onMouseLeave: () => dispatch("mouse_leave"), onMouseEnter: () => dispatch("mouse_enter"), onClick: () => dispatch("click"), children: [withHeader && (_jsx("div", { className: `frame ${["active", "default", "disabled", "hover"].includes(state.status) ? frameClassName : ""}`, children: _jsx("div", { className: `label-2 ${state.status}`, children: headerText }) })), _jsxs("div", { className: `input-fields size-4-${state.size} status-0-${state.status}`, onClick: toggleDropdown, children: [leftIcon && React.cloneElement(leftIcon, { color: state.status === "alert" ? "#FF6983" : "#888888" }), _jsx("input", { type: isPassword ? (isPasswordVisible ? "text" : "password") : "text", placeholder: text, value: currentValue, onChange: handleInputChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, className: `input-field-placeholder ${state.status === "alert" ? "alert" : ""}`, style: {
48
59
  backgroundColor: "transparent",
49
60
  border: "none",
50
61
  color: state.status === "alert" ? "#FF6983" : "#888888",
@@ -52,7 +63,7 @@ export const InputField = ({ withAlertIcon = true, withAlertMessage = true, left
52
63
  minWidth: 0,
53
64
  outline: "none",
54
65
  padding: "0",
55
- } }), clearable && !!currentValue && currentValue.length > 0 && (_jsx(IconX, { stroke: 1.5, className: "button-clear", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: handleClear })), rightIcon && isPassword && (isPasswordVisible ? (_jsx(IconEyeOff, { stroke: 1.5, className: "button-password-eye", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: () => setIsPasswordVisible(!isPasswordVisible) })) : (_jsx(IconEye, { stroke: 1.5, className: "button-password-eye", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: () => setIsPasswordVisible(!isPasswordVisible) }))), rightIcon && React.cloneElement(rightIcon, { color: state.status === "alert" ? "#FF6983" : "#888888" })] }), state.status === "alert" && withAlertMessage && (_jsxs("div", { className: "frame-2", children: [withAlertIcon && _jsx(IconAlertSquareRounded, { size: 20, stroke: 1.5 }), _jsx("div", { className: "doldurulmas-zorunlu", children: alertText })] }))] }));
66
+ }, readOnly: selectFromPopup }), clearable && !!currentValue && currentValue.length > 0 && (_jsx(IconX, { stroke: 1.5, className: "button-clear", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: handleClear })), rightIcon && isPassword && (isPasswordVisible ? (_jsx(IconEyeOff, { stroke: 1.5, className: "button-password-eye", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: () => setIsPasswordVisible(!isPasswordVisible) })) : (_jsx(IconEye, { stroke: 1.5, className: "button-password-eye", color: state.status === "alert" ? "#FF6983" : "#888888", onClick: () => setIsPasswordVisible(!isPasswordVisible) }))), rightIcon && React.cloneElement(rightIcon, { color: state.status === "alert" ? "#FF6983" : "#888888" })] }), false, state.status === "alert" && withAlertMessage && (_jsxs("div", { className: "frame-2", children: [withAlertIcon && _jsx(IconAlertSquareRounded, { size: 20, stroke: 1.5 }), _jsx("div", { className: "doldurulmas-zorunlu", children: alertText })] }))] }));
56
67
  };
57
68
  InputField.propTypes = {
58
69
  withAlertIcon: PropTypes.bool,
@@ -78,4 +89,6 @@ InputField.propTypes = {
78
89
  onKeyDown: PropTypes.func,
79
90
  clearable: PropTypes.bool,
80
91
  onClear: PropTypes.func,
92
+ selectFromPopup: PropTypes.bool,
93
+ onRequestPopupOpen: PropTypes.func,
81
94
  };
@@ -160,6 +160,7 @@
160
160
  height: 32px;
161
161
  padding: 6px;
162
162
  width: 100%;
163
+ border-radius: 8px;
163
164
  }
164
165
 
165
166
  .input-field .status-0-default {
@@ -13,9 +13,10 @@ interface Props {
13
13
  bold?: "off" | "on";
14
14
  spacing?: "off" | "on";
15
15
  className: any;
16
+ divClassName?: string;
16
17
  }
17
18
  export declare const Label: {
18
- ({ text, title, leftIcon, rightIcon, size, color, version, stroke, bold, spacing, className, }: Props): React.JSX.Element;
19
+ ({ text, title, leftIcon, rightIcon, size, color, version, stroke, bold, spacing, className, divClassName, }: Props): React.JSX.Element;
19
20
  propTypes: {
20
21
  text: PropTypes.Requireable<string>;
21
22
  title: PropTypes.Requireable<string>;
@@ -28,6 +29,7 @@ export declare const Label: {
28
29
  stroke: PropTypes.Requireable<string>;
29
30
  bold: PropTypes.Requireable<string>;
30
31
  spacing: PropTypes.Requireable<string>;
32
+ divClassName: PropTypes.Requireable<string>;
31
33
  };
32
34
  };
33
35
  export {};
@@ -32,11 +32,11 @@ const getIconClassName = (size) => {
32
32
  };
33
33
  return sizeClassMap[size] || "";
34
34
  };
35
- export const Label = ({ text, title, leftIcon, rightIcon, size, color, version, stroke = "off", bold, spacing, className, }) => {
35
+ export const Label = ({ text, title, leftIcon, rightIcon, size, color, version, stroke = "off", bold, spacing, className, divClassName, }) => {
36
36
  return (_jsxs("div", { className: `label ${size} ${stroke} ${spacing} ${color} ${className}`, title: title, children: [leftIcon && (React.cloneElement(leftIcon, {
37
37
  className: getIconClassName(size),
38
38
  color: getIconColor(version, color)
39
- })), text && (_jsx("div", { className: `text-wrapper ${version} bold-${bold} size-${size} color-${color}`, children: text })), rightIcon && (React.cloneElement(rightIcon, {
39
+ })), text && (_jsx("div", { className: `text-wrapper ${version} bold-${bold} size-${size} color-${color} ${divClassName || ""}`, children: text })), rightIcon && (React.cloneElement(rightIcon, {
40
40
  className: getIconClassName(size),
41
41
  color: getIconColor(version, color)
42
42
  }))] }));
@@ -64,4 +64,5 @@ Label.propTypes = {
64
64
  stroke: PropTypes.oneOf(["off", "on"]),
65
65
  bold: PropTypes.oneOf(["off", "on"]),
66
66
  spacing: PropTypes.oneOf(["off", "on"]),
67
+ divClassName: PropTypes.string,
67
68
  };
@@ -0,0 +1,27 @@
1
+ import PropTypes from "prop-types";
2
+ import "./style.css";
3
+ interface Props {
4
+ text?: string;
5
+ subtext?: string;
6
+ activity?: boolean;
7
+ size?: "large" | "x-small" | "medium" | "small";
8
+ status?: "pressing" | "default";
9
+ className?: any;
10
+ avatarLetter?: string;
11
+ avatarColor?: string;
12
+ activityColor?: string;
13
+ }
14
+ export declare const ProfileButton: {
15
+ ({ text, subtext, activity, size, status, avatarLetter, avatarColor, className, activityColor, }: Props): React.JSX.Element;
16
+ propTypes: {
17
+ text: PropTypes.Requireable<string>;
18
+ withText: PropTypes.Requireable<boolean>;
19
+ subtext: PropTypes.Requireable<string>;
20
+ withSubtext: PropTypes.Requireable<boolean>;
21
+ withAllText: PropTypes.Requireable<boolean>;
22
+ activity: PropTypes.Requireable<boolean>;
23
+ size: PropTypes.Requireable<string>;
24
+ status: PropTypes.Requireable<string>;
25
+ };
26
+ };
27
+ export {};
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import PropTypes from "prop-types";
3
+ import "./style.css";
4
+ import { Avatar } from "../Avatar";
5
+ import { Activity } from "../Activity";
6
+ export const ProfileButton = ({ text, subtext, activity = false, size, status, avatarLetter = "AB", avatarColor = "grey", className, activityColor = "black", }) => {
7
+ return (_jsxs("div", { className: `profile-button size-0-${size} ${status} ${className}`, children: [_jsx(Avatar, { className: "avatar-instance", color: avatarColor, letter: avatarLetter, size: size === "medium"
8
+ ? "medium"
9
+ : size === "small"
10
+ ? "small"
11
+ : size === "x-small"
12
+ ? "x-small"
13
+ : "large", status: "default", version: "default" }), _jsxs("div", { className: "frame", children: [text && _jsx("div", { className: "text", children: text }), subtext && _jsx("div", { className: "subtext", children: subtext })] }), activity && (_jsx(Activity, { className: `${size === "medium" ? "class" : (size === "small") ? "class-2" : size === "x-small" ? "class-3" : "class-4"}`, color: activityColor === "black" || activityColor === "green" || activityColor === "galliano" || activityColor === "red" ? activityColor : undefined, size: "x-small" }))] }));
14
+ };
15
+ ProfileButton.propTypes = {
16
+ text: PropTypes.string,
17
+ withText: PropTypes.bool,
18
+ subtext: PropTypes.string,
19
+ withSubtext: PropTypes.bool,
20
+ withAllText: PropTypes.bool,
21
+ activity: PropTypes.bool,
22
+ size: PropTypes.oneOf(["large", "x-small", "medium", "small"]),
23
+ status: PropTypes.oneOf(["pressing", "default"]),
24
+ };
@@ -0,0 +1 @@
1
+ export { ProfileButton } from "./ProfileButton";
@@ -0,0 +1 @@
1
+ export { ProfileButton } from "./ProfileButton";
@@ -0,0 +1,176 @@
1
+ .profile-button {
2
+ align-items: center;
3
+ display: inline-flex;
4
+ padding: 4px;
5
+ position: relative;
6
+ }
7
+
8
+ .profile-button .frame {
9
+ align-items: flex-start;
10
+ display: inline-flex;
11
+ flex: 0 0 auto;
12
+ flex-direction: column;
13
+ justify-content: center;
14
+ position: relative;
15
+ }
16
+
17
+ .profile-button .text {
18
+ -webkit-box-orient: vertical;
19
+ color: #5d5d5d;
20
+ display: -webkit-box;
21
+ overflow: hidden;
22
+ position: relative;
23
+ text-overflow: ellipsis;
24
+ }
25
+
26
+ .profile-button .subtext {
27
+ align-self: stretch;
28
+ color: #5d5d5d;
29
+ position: relative;
30
+ }
31
+
32
+ .profile-button .class {
33
+ left: 29px !important;
34
+ position: absolute !important;
35
+ top: 2px !important;
36
+ }
37
+
38
+ .profile-button .class-2 {
39
+ left: 24px !important;
40
+ position: absolute !important;
41
+ top: 2px !important;
42
+ }
43
+
44
+ .profile-button .class-3 {
45
+ left: 20px !important;
46
+ position: absolute !important;
47
+ top: 2px !important;
48
+ }
49
+
50
+ .profile-button .class-4 {
51
+ left: 48px !important;
52
+ position: absolute !important;
53
+ top: 2px !important;
54
+ }
55
+
56
+ .profile-button.size-0-large {
57
+ border-radius: 16px;
58
+ gap: 8px;
59
+ top: 12px;
60
+ }
61
+
62
+ .profile-button.size-0-small {
63
+ border-radius: 12px;
64
+ gap: 6px;
65
+ }
66
+
67
+ .profile-button.size-0-medium {
68
+ border-radius: 12px;
69
+ gap: 6px;
70
+ }
71
+
72
+ .profile-button.size-0-x-small {
73
+ border-radius: 8px;
74
+ gap: 6px;
75
+ }
76
+
77
+ .profile-button.pressing {
78
+ background-color: #2424240d;
79
+ }
80
+ .profile-button.size-0-x-small .frame {
81
+ height: 24px;
82
+ }
83
+
84
+ .profile-button.size-0-large .frame {
85
+ gap: 6px;
86
+ }
87
+
88
+ .profile-button.size-0-small .frame {
89
+ height: 28px;
90
+ }
91
+
92
+ .profile-button.size-0-x-small .text {
93
+ -webkit-line-clamp: 0;
94
+ font-family: var(--b2-bold-font-family);
95
+ font-size: var(--b2-bold-font-size);
96
+ font-style: var(--b2-bold-font-style);
97
+ font-weight: var(--b2-bold-font-weight);
98
+ height: 14px;
99
+ letter-spacing: var(--b2-bold-letter-spacing);
100
+ line-height: var(--b2-bold-line-height);
101
+ margin-top: -3.00px;
102
+ white-space: nowrap;
103
+ }
104
+
105
+ .profile-button.size-0-large .text {
106
+ -webkit-line-clamp: 0;
107
+ font-family: var(--h5-bold-font-family);
108
+ font-size: var(--h5-bold-font-size);
109
+ font-style: var(--h5-bold-font-style);
110
+ font-weight: var(--h5-bold-font-weight);
111
+ letter-spacing: var(--h5-bold-letter-spacing);
112
+ line-height: var(--h5-bold-line-height);
113
+ margin-top: -1.00px;
114
+ }
115
+
116
+ .profile-button.size-0-medium .text {
117
+ -webkit-line-clamp: 1;
118
+ font-family: var(--b1-bold-font-family);
119
+ font-size: var(--b1-bold-font-size);
120
+ font-style: var(--b1-bold-font-style);
121
+ font-weight: var(--b1-bold-font-weight);
122
+ letter-spacing: var(--b1-bold-letter-spacing);
123
+ line-height: var(--b1-bold-line-height);
124
+ margin-top: -1.00px;
125
+ }
126
+
127
+ .profile-button.size-0-small .text {
128
+ -webkit-line-clamp: 1;
129
+ font-family: var(--b2-bold-font-family);
130
+ font-size: var(--b2-bold-font-size);
131
+ font-style: var(--b2-bold-font-style);
132
+ font-weight: var(--b2-bold-font-weight);
133
+ letter-spacing: var(--b2-bold-letter-spacing);
134
+ line-height: var(--b2-bold-line-height);
135
+ margin-top: -3.00px;
136
+ }
137
+
138
+ .profile-button.size-0-x-small .subtext {
139
+ font-family: var(--b3-medium-font-family);
140
+ font-size: var(--b3-medium-font-size);
141
+ font-style: var(--b3-medium-font-style);
142
+ font-weight: var(--b3-medium-font-weight);
143
+ height: 14px;
144
+ letter-spacing: var(--b3-medium-letter-spacing);
145
+ line-height: var(--b3-medium-line-height);
146
+ margin-bottom: -1.00px;
147
+ white-space: nowrap;
148
+ }
149
+
150
+ .profile-button.size-0-large .subtext {
151
+ font-family: var(--b1-medium-font-family);
152
+ font-size: var(--b1-medium-font-size);
153
+ font-style: var(--b1-medium-font-style);
154
+ font-weight: var(--b1-medium-font-weight);
155
+ letter-spacing: var(--b1-medium-letter-spacing);
156
+ line-height: var(--b1-medium-line-height);
157
+ }
158
+
159
+ .profile-button.size-0-medium .subtext {
160
+ font-family: var(--b2-medium-font-family);
161
+ font-size: var(--b2-medium-font-size);
162
+ font-style: var(--b2-medium-font-style);
163
+ font-weight: var(--b2-medium-font-weight);
164
+ letter-spacing: var(--b2-medium-letter-spacing);
165
+ line-height: var(--b2-medium-line-height);
166
+ }
167
+
168
+ .profile-button.size-0-small .subtext {
169
+ font-family: var(--b3-medium-font-family);
170
+ font-size: var(--b3-medium-font-size);
171
+ font-style: var(--b3-medium-font-style);
172
+ font-weight: var(--b3-medium-font-weight);
173
+ letter-spacing: var(--b3-medium-letter-spacing);
174
+ line-height: var(--b3-medium-line-height);
175
+ margin-bottom: -1.00px;
176
+ }
package/dist/index.d.ts CHANGED
@@ -14,3 +14,4 @@ export { Page } from "./Page/Page";
14
14
  export { PlatformsButton } from "./PlatformsButton/PlatformsButton";
15
15
  export { PlatformSelector } from "./PlatformSelector/PlatformSelector";
16
16
  export { SingleSlider } from "./SingleSlider/SingleSlider";
17
+ export { ProfileButton } from "./ProfileButton/ProfileButton";
package/dist/index.js CHANGED
@@ -14,3 +14,4 @@ export { Page } from "./Page/Page";
14
14
  export { PlatformsButton } from "./PlatformsButton/PlatformsButton";
15
15
  export { PlatformSelector } from "./PlatformSelector/PlatformSelector";
16
16
  export { SingleSlider } from "./SingleSlider/SingleSlider";
17
+ export { ProfileButton } from "./ProfileButton/ProfileButton";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayseaistudio/ui-components",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",