ar-design 0.3.77 → 0.3.79

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.
@@ -0,0 +1,50 @@
1
+ .ar-input-phone-wrapper {
2
+ display: flex;
3
+ flex-direction: row;
4
+
5
+ > .ar-select-wrapper {
6
+ flex: 0 0 20%;
7
+
8
+ > .ar-select {
9
+ > .ar-input-wrapper {
10
+ > .ar-input {
11
+ > .input {
12
+ > input {
13
+ border-right: none;
14
+ border-radius: 0;
15
+ border-top-left-radius: var(--border-radius-sm);
16
+ border-bottom-left-radius: var(--border-radius-sm);
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+
24
+ > .ar-input-wrapper {
25
+ flex: 1;
26
+
27
+ > .ar-input {
28
+ > .input {
29
+ > input {
30
+ border-radius: 0;
31
+ border-top-right-radius: var(--border-radius-sm);
32
+ border-bottom-right-radius: var(--border-radius-sm);
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ /* @media (max-width: 600px) {
39
+ flex-direction: column;
40
+
41
+ .ar-select-wrapper,
42
+ .ar-input-wrapper {
43
+ flex: 1 1 100%;
44
+
45
+ .ar-input .input input {
46
+ border-radius: var(--border-radius-sm);
47
+ }
48
+ }
49
+ } */
50
+ }
@@ -101,6 +101,8 @@
101
101
  }
102
102
  }
103
103
 
104
+ /* PHONE */
105
+ @import url("./phone/styles.css");
104
106
  /* OTP */
105
107
  @import url("./otp/styles.css");
106
108
 
@@ -1,8 +1,8 @@
1
1
  /* #region BLUE */
2
2
  .filled:not(.disabled) {
3
3
  &.blue {
4
- background-color: var(--blue-500);
5
- color: var(--white);
4
+ background-color: var(--blue-500) !important;
5
+ color: var(--white) !important;
6
6
 
7
7
  &.active {
8
8
  animation: clicked-blue ease-in-out 750ms 0s 1 normal both;
@@ -40,8 +40,8 @@ button.filled:not(.disabled) {
40
40
  /* #region PURPLE */
41
41
  .filled:not(.disabled) {
42
42
  &.purple {
43
- background-color: var(--purple-500);
44
- color: var(--white);
43
+ background-color: var(--purple-500) !important;
44
+ color: var(--white) !important;
45
45
 
46
46
  &.active {
47
47
  animation: clicked-purple ease-in-out 750ms 0s 1 normal both;
@@ -79,8 +79,8 @@ button.filled:not(.disabled) {
79
79
  /* #region PINK */
80
80
  .filled:not(.disabled) {
81
81
  &.pink {
82
- background-color: var(--pink-500);
83
- color: var(--white);
82
+ background-color: var(--pink-500) !important;
83
+ color: var(--white) !important;
84
84
 
85
85
  &.active {
86
86
  animation: clicked-pink ease-in-out 750ms 0s 1 normal both;
@@ -118,8 +118,8 @@ button.filled:not(.disabled) {
118
118
  /* #region RED */
119
119
  .filled:not(.disabled) {
120
120
  &.red {
121
- background-color: var(--red-500);
122
- color: var(--white);
121
+ background-color: var(--red-500) !important;
122
+ color: var(--white) !important;
123
123
 
124
124
  &.active {
125
125
  animation: clicked-red ease-in-out 750ms 0s 1 normal both;
@@ -157,8 +157,8 @@ button.filled:not(.disabled) {
157
157
  /* #region ORANGE */
158
158
  .filled:not(.disabled) {
159
159
  &.orange {
160
- background-color: var(--orange-500);
161
- color: var(--white);
160
+ background-color: var(--orange-500) !important;
161
+ color: var(--white) !important;
162
162
 
163
163
  &.active {
164
164
  animation: clicked-orange ease-in-out 750ms 0s 1 normal both;
@@ -196,8 +196,8 @@ button.filled:not(.disabled) {
196
196
  /* #region YELLOW */
197
197
  .filled:not(.disabled) {
198
198
  &.yellow {
199
- background-color: var(--yellow-500);
200
- color: var(--black);
199
+ background-color: var(--yellow-500) !important;
200
+ color: var(--black) !important;
201
201
 
202
202
  &.active {
203
203
  animation: clicked-yellow ease-in-out 750ms 0s 1 normal both;
@@ -235,8 +235,8 @@ button.filled:not(.disabled) {
235
235
  /* #region GREEN */
236
236
  .filled:not(.disabled) {
237
237
  &.green {
238
- background-color: var(--green-500);
239
- color: var(--white);
238
+ background-color: var(--green-500) !important;
239
+ color: var(--white) !important;
240
240
 
241
241
  &.active {
242
242
  animation: clicked-green ease-in-out 750ms 0s 1 normal both;
@@ -274,8 +274,8 @@ button.filled:not(.disabled) {
274
274
  /* #region TEAL */
275
275
  .filled:not(.disabled) {
276
276
  &.teal {
277
- background-color: var(--teal-500);
278
- color: var(--white);
277
+ background-color: var(--teal-500) !important;
278
+ color: var(--white) !important;
279
279
 
280
280
  &.active {
281
281
  animation: clicked-teal ease-in-out 750ms 0s 1 normal both;
@@ -313,8 +313,8 @@ button.filled:not(.disabled) {
313
313
  /* #region CYAN */
314
314
  .filled:not(.disabled) {
315
315
  &.cyan {
316
- background-color: var(--cyan-500);
317
- color: var(--white);
316
+ background-color: var(--cyan-500) !important;
317
+ color: var(--white) !important;
318
318
 
319
319
  &.active {
320
320
  animation: clicked-cyan ease-in-out 750ms 0s 1 normal both;
@@ -352,8 +352,8 @@ button.filled:not(.disabled) {
352
352
  /* #region GRAY */
353
353
  .filled:not(.disabled) {
354
354
  &.gray {
355
- background-color: var(--gray-500);
356
- color: var(--black);
355
+ background-color: var(--gray-500) !important;
356
+ color: var(--black) !important;
357
357
 
358
358
  &.active {
359
359
  animation: clicked-gray ease-in-out 750ms 0s 1 normal both;
@@ -391,8 +391,8 @@ button.filled:not(.disabled) {
391
391
  /* #region LIGHT */
392
392
  .filled:not(.disabled) {
393
393
  &.light {
394
- background-color: var(--light-500);
395
- color: var(--gray-500);
394
+ background-color: var(--light-500) !important;
395
+ color: var(--gray-500) !important;
396
396
 
397
397
  &.active {
398
398
  animation: clicked-light ease-in-out 750ms 0s 1 normal both;
@@ -15,7 +15,7 @@ const Tabs = ({ name, tabs = [], activeTab, onChange, onClose }) => {
15
15
  setCurrentTab(stored !== null ? Number(stored) : 0);
16
16
  onChange?.(stored !== null ? Number(stored) : 0);
17
17
  setIsLoading(false);
18
- }, []);
18
+ }, [name]);
19
19
  if (isLoading)
20
20
  return React.createElement(Skeleton, { name: name, tabs: tabs });
21
21
  return (React.createElement("div", { className: "ar-tabs" },
@@ -3,8 +3,10 @@ import "../../../assets/css/components/form/input/styles.css";
3
3
  import IProps from "./IProps";
4
4
  import Otp from "./otp/Otp";
5
5
  import Num from "./num/Num";
6
+ import Phone from "./phone/Phone";
6
7
  interface InputCompound extends React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLInputElement>> {
7
8
  Number: typeof Num;
9
+ Phone: typeof Phone;
8
10
  Otp: typeof Otp;
9
11
  }
10
12
  declare const Input: InputCompound;
@@ -6,6 +6,7 @@ import Utils from "../../../libs/infrastructure/shared/Utils";
6
6
  import { ARIcon } from "../../icons";
7
7
  import Otp from "./otp/Otp";
8
8
  import Num from "./num/Num";
9
+ import Phone from "./phone/Phone";
9
10
  const BaseInput = forwardRef(({ variant = "outlined", color = "light", icon, border = { radius: "sm" }, button, addon, upperCase, validation, ...attributes }, ref) => {
10
11
  // refs
11
12
  const _innerRef = useRef(null);
@@ -89,6 +90,7 @@ const BaseInput = forwardRef(({ variant = "outlined", color = "light", icon, bor
89
90
  : {}), ...(value
90
91
  ? {
91
92
  style: {
93
+ ...attributes.style,
92
94
  clipPath: `polygon(
93
95
  -15px 0,
94
96
  10px -5px,
@@ -101,7 +103,7 @@ const BaseInput = forwardRef(({ variant = "outlined", color = "light", icon, bor
101
103
  )`,
102
104
  },
103
105
  }
104
- : {}), onChange: (event) => {
106
+ : { style: { ...attributes.style } }), onChange: (event) => {
105
107
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
106
108
  if (attributes.disabled)
107
109
  return;
@@ -141,7 +143,8 @@ const BaseInput = forwardRef(({ variant = "outlined", color = "light", icon, bor
141
143
  button && React.createElement(Button, { ...button, border: { radius: border.radius }, disabled: attributes.disabled })));
142
144
  });
143
145
  const Input = BaseInput;
144
- Input.Otp = Otp;
145
146
  Input.Number = Num;
147
+ Input.Phone = Phone;
148
+ Input.Otp = Otp;
146
149
  BaseInput.displayName = "Input";
147
150
  export default Input;
@@ -71,7 +71,7 @@ const Num = ({ variant, color, name, value, onChange, locale = "tr-TR", digits,
71
71
  // setValue(getFormatter.format(Number(value)));
72
72
  // _firstLoad.current = true;
73
73
  // }
74
- setValue(getFormatter.format(window.Number(value)));
74
+ setValue(getFormatter.format(Number(value)));
75
75
  }, [value]);
76
76
  return (React.createElement(Input, { ref: _input, name: name, variant: variant, color: color, value: _value ?? "", type: "text", inputMode: "decimal", onChange: (event) => {
77
77
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
@@ -0,0 +1,12 @@
1
+ import { IBorder, IColors, IDisabled, IPlaceholder, IValidation, IVariant } from "../../../../libs/types/IGlobalProps";
2
+ import { Option } from "../../../../libs/types";
3
+ interface IProps extends IVariant, IColors, IBorder, IValidation, IPlaceholder, IDisabled {
4
+ name: string;
5
+ values: {
6
+ option: string;
7
+ value: string | number | readonly string[] | undefined;
8
+ };
9
+ onSelected: (option: Option | undefined) => void;
10
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
11
+ }
12
+ export default IProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import IProps from "./IProps";
3
+ declare const Phone: React.FC<IProps>;
4
+ export default Phone;
@@ -0,0 +1,245 @@
1
+ "use client";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import Input from "..";
4
+ import Select from "../../select";
5
+ import PhoneMask from "../../../../libs/infrastructure/shared/PhoneMask";
6
+ const options = [
7
+ // #---- TR
8
+ { text: "🇹🇷 (+90)", value: "+90" },
9
+ // #---- OTHER
10
+ { text: "🇦🇫 (+93)", value: "+93" },
11
+ { text: "🇦🇱 (+355)", value: "+355" },
12
+ { text: "🇩🇿 (+213)", value: "+213" },
13
+ { text: "🇦🇸 (+1)", value: "+1" },
14
+ { text: "🇦🇩 (+376)", value: "+376" },
15
+ { text: "🇦🇴 (+244)", value: "+244" },
16
+ { text: "🇦🇮 (+1)", value: "+1" },
17
+ { text: "🇦🇬 (+1)", value: "+1" },
18
+ { text: "🇦🇷 (+54)", value: "+54" },
19
+ { text: "🇦🇲 (+374)", value: "+374" },
20
+ { text: "🇦🇼 (+297)", value: "+297" },
21
+ { text: "🇦🇺 (+61)", value: "+61" },
22
+ { text: "🇦🇹 (+43)", value: "+43" },
23
+ { text: "🇦🇿 (+994)", value: "+994" },
24
+ { text: "🇧🇸 (+1)", value: "+1" },
25
+ { text: "🇧🇭 (+973)", value: "+973" },
26
+ { text: "🇧🇩 (+880)", value: "+880" },
27
+ { text: "🇧🇧 (+1)", value: "+1" },
28
+ { text: "🇧🇾 (+375)", value: "+375" },
29
+ { text: "🇧🇪 (+32)", value: "+32" },
30
+ { text: "🇧🇿 (+501)", value: "+501" },
31
+ { text: "🇧🇯 (+229)", value: "+229" },
32
+ { text: "🇧🇲 (+1)", value: "+1" },
33
+ { text: "🇧🇹 (+975)", value: "+975" },
34
+ { text: "🇧🇴 (+591)", value: "+591" },
35
+ { text: "🇧🇦 (+387)", value: "+387" },
36
+ { text: "🇧🇼 (+267)", value: "+267" },
37
+ { text: "🇧🇷 (+55)", value: "+55" },
38
+ { text: "🇧🇳 (+673)", value: "+673" },
39
+ { text: "🇧🇬 (+359)", value: "+359" },
40
+ { text: "🇧🇫 (+226)", value: "+226" },
41
+ { text: "🇧🇮 (+257)", value: "+257" },
42
+ { text: "🇰🇭 (+855)", value: "+855" },
43
+ { text: "🇨🇲 (+237)", value: "+237" },
44
+ { text: "🇨🇦 (+1)", value: "+1" },
45
+ { text: "🇨🇻 (+238)", value: "+238" },
46
+ { text: "🇨🇫 (+236)", value: "+236" },
47
+ { text: "🇹🇩 (+235)", value: "+235" },
48
+ { text: "🇨🇱 (+56)", value: "+56" },
49
+ { text: "🇨🇳 (+86)", value: "+86" },
50
+ { text: "🇨🇴 (+57)", value: "+57" },
51
+ { text: "🇰🇲 (+269)", value: "+269" },
52
+ { text: "🇨🇬 (+242)", value: "+242" },
53
+ { text: "🇨🇷 (+506)", value: "+506" },
54
+ { text: "🇭🇷 (+385)", value: "+385" },
55
+ { text: "🇨🇺 (+53)", value: "+53" },
56
+ { text: "🇨🇾 (+357)", value: "+357" },
57
+ { text: "🇨🇿 (+420)", value: "+420" },
58
+ { text: "🇩🇰 (+45)", value: "+45" },
59
+ { text: "🇩🇯 (+253)", value: "+253" },
60
+ { text: "🇩🇲 (+1)", value: "+1" },
61
+ { text: "🇩🇴 (+1)", value: "+1" },
62
+ { text: "🇪🇨 (+593)", value: "+593" },
63
+ { text: "🇪🇬 (+20)", value: "+20" },
64
+ { text: "🇸🇻 (+503)", value: "+503" },
65
+ { text: "🇪🇪 (+372)", value: "+372" },
66
+ { text: "🇪🇹 (+251)", value: "+251" },
67
+ { text: "🇫🇯 (+679)", value: "+679" },
68
+ { text: "🇫🇮 (+358)", value: "+358" },
69
+ { text: "🇫🇷 (+33)", value: "+33" },
70
+ { text: "🇬🇦 (+241)", value: "+241" },
71
+ { text: "🇬🇲 (+220)", value: "+220" },
72
+ { text: "🇬🇪 (+995)", value: "+995" },
73
+ { text: "🇩🇪 (+49)", value: "+49" },
74
+ { text: "🇬🇭 (+233)", value: "+233" },
75
+ { text: "🇬🇷 (+30)", value: "+30" },
76
+ { text: "🇬🇩 (+1)", value: "+1" },
77
+ { text: "🇬🇹 (+502)", value: "+502" },
78
+ { text: "🇬🇳 (+224)", value: "+224" },
79
+ { text: "🇬🇼 (+245)", value: "+245" },
80
+ { text: "🇬🇾 (+592)", value: "+592" },
81
+ { text: "🇭🇹 (+509)", value: "+509" },
82
+ { text: "🇭🇳 (+504)", value: "+504" },
83
+ { text: "🇭🇰 (+852)", value: "+852" },
84
+ { text: "🇭🇺 (+36)", value: "+36" },
85
+ { text: "🇮🇸 (+354)", value: "+354" },
86
+ { text: "🇮🇳 (+91)", value: "+91" },
87
+ { text: "🇮🇩 (+62)", value: "+62" },
88
+ { text: "🇮🇷 (+98)", value: "+98" },
89
+ { text: "🇮🇶 (+964)", value: "+964" },
90
+ { text: "🇮🇪 (+353)", value: "+353" },
91
+ { text: "🇮🇱 (+972)", value: "+972" },
92
+ { text: "🇮🇹 (+39)", value: "+39" },
93
+ { text: "🇨🇮 (+225)", value: "+225" },
94
+ { text: "🇯🇲 (+1)", value: "+1" },
95
+ { text: "🇯🇵 (+81)", value: "+81" },
96
+ { text: "🇯🇴 (+962)", value: "+962" },
97
+ { text: "🇰🇿 (+7)", value: "+7" },
98
+ { text: "🇰🇪 (+254)", value: "+254" },
99
+ { text: "🇰🇮 (+686)", value: "+686" },
100
+ { text: "🇰🇼 (+965)", value: "+965" },
101
+ { text: "🇰🇬 (+996)", value: "+996" },
102
+ { text: "🇱🇦 (+856)", value: "+856" },
103
+ { text: "🇱🇻 (+371)", value: "+371" },
104
+ { text: "🇱🇧 (+961)", value: "+961" },
105
+ { text: "🇱🇸 (+266)", value: "+266" },
106
+ { text: "🇱🇷 (+231)", value: "+231" },
107
+ { text: "🇱🇾 (+218)", value: "+218" },
108
+ { text: "🇱🇹 (+370)", value: "+370" },
109
+ { text: "🇱🇺 (+352)", value: "+352" },
110
+ { text: "🇲🇰 (+389)", value: "+389" },
111
+ { text: "🇲🇬 (+261)", value: "+261" },
112
+ { text: "🇲🇼 (+265)", value: "+265" },
113
+ { text: "🇲🇾 (+60)", value: "+60" },
114
+ { text: "🇲🇻 (+960)", value: "+960" },
115
+ { text: "🇲🇱 (+223)", value: "+223" },
116
+ { text: "🇲🇹 (+356)", value: "+356" },
117
+ { text: "🇲🇷 (+222)", value: "+222" },
118
+ { text: "🇲🇺 (+230)", value: "+230" },
119
+ { text: "🇲🇽 (+52)", value: "+52" },
120
+ { text: "🇫🇲 (+691)", value: "+691" },
121
+ { text: "🇲🇩 (+373)", value: "+373" },
122
+ { text: "🇲🇨 (+377)", value: "+377" },
123
+ { text: "🇲🇳 (+976)", value: "+976" },
124
+ { text: "🇲🇪 (+382)", value: "+382" },
125
+ { text: "🇲🇦 (+212)", value: "+212" },
126
+ { text: "🇲🇿 (+258)", value: "+258" },
127
+ { text: "🇲🇲 (+95)", value: "+95" },
128
+ { text: "🇳🇦 (+264)", value: "+264" },
129
+ { text: "🇳🇷 (+674)", value: "+674" },
130
+ { text: "🇳🇵 (+977)", value: "+977" },
131
+ { text: "🇳🇱 (+31)", value: "+31" },
132
+ { text: "🇳🇿 (+64)", value: "+64" },
133
+ { text: "🇳🇮 (+505)", value: "+505" },
134
+ { text: "🇳🇪 (+227)", value: "+227" },
135
+ { text: "🇳🇬 (+234)", value: "+234" },
136
+ { text: "🇳🇺 (+683)", value: "+683" },
137
+ { text: "🇰🇵 (+850)", value: "+850" },
138
+ { text: "🇲🇵 (+1)", value: "+1" },
139
+ { text: "🇳🇴 (+47)", value: "+47" },
140
+ { text: "🇴🇲 (+968)", value: "+968" },
141
+ { text: "🇵🇰 (+92)", value: "+92" },
142
+ { text: "🇵🇼 (+680)", value: "+680" },
143
+ { text: "🇵🇦 (+507)", value: "+507" },
144
+ { text: "🇵🇬 (+675)", value: "+675" },
145
+ { text: "🇵🇾 (+595)", value: "+595" },
146
+ { text: "🇵🇪 (+51)", value: "+51" },
147
+ { text: "🇵🇭 (+63)", value: "+63" },
148
+ { text: "🇵🇱 (+48)", value: "+48" },
149
+ { text: "🇵🇹 (+351)", value: "+351" },
150
+ { text: "🇶🇦 (+974)", value: "+974" },
151
+ { text: "🇷🇴 (+40)", value: "+40" },
152
+ { text: "🇷🇺 (+7)", value: "+7" },
153
+ { text: "🇷🇼 (+250)", value: "+250" },
154
+ { text: "🇰🇳 (+1)", value: "+1" },
155
+ { text: "🇱🇨 (+1)", value: "+1" },
156
+ { text: "🇻🇨 (+1)", value: "+1" },
157
+ { text: "🇼🇸 (+685)", value: "+685" },
158
+ { text: "🇸🇲 (+378)", value: "+378" },
159
+ { text: "🇸🇹 (+239)", value: "+239" },
160
+ { text: "🇸🇦 (+966)", value: "+966" },
161
+ { text: "🇸🇳 (+221)", value: "+221" },
162
+ { text: "🇷🇸 (+381)", value: "+381" },
163
+ { text: "🇸🇨 (+248)", value: "+248" },
164
+ { text: "🇸🇱 (+232)", value: "+232" },
165
+ { text: "🇸🇬 (+65)", value: "+65" },
166
+ { text: "🇸🇰 (+421)", value: "+421" },
167
+ { text: "🇸🇮 (+386)", value: "+386" },
168
+ { text: "🇸🇧 (+677)", value: "+677" },
169
+ { text: "🇸🇴 (+252)", value: "+252" },
170
+ { text: "🇿🇦 (+27)", value: "+27" },
171
+ { text: "🇰🇷 (+82)", value: "+82" },
172
+ { text: "🇸🇸 (+211)", value: "+211" },
173
+ { text: "🇪🇸 (+34)", value: "+34" },
174
+ { text: "🇱🇰 (+94)", value: "+94" },
175
+ { text: "🇸🇩 (+249)", value: "+249" },
176
+ { text: "🇸🇷 (+597)", value: "+597" },
177
+ { text: "🇸🇪 (+46)", value: "+46" },
178
+ { text: "🇨🇭 (+41)", value: "+41" },
179
+ { text: "🇸🇾 (+963)", value: "+963" },
180
+ { text: "🇹🇯 (+992)", value: "+992" },
181
+ { text: "🇹🇿 (+255)", value: "+255" },
182
+ { text: "🇹🇭 (+66)", value: "+66" },
183
+ { text: "🇹🇱 (+670)", value: "+670" },
184
+ { text: "🇹🇬 (+228)", value: "+228" },
185
+ { text: "🇹🇴 (+676)", value: "+676" },
186
+ { text: "🇹🇹 (+1)", value: "+1" },
187
+ { text: "🇹🇳 (+216)", value: "+216" },
188
+ { text: "🇹🇲 (+993)", value: "+993" },
189
+ { text: "🇹🇻 (+688)", value: "+688" },
190
+ { text: "🇺🇬 (+256)", value: "+256" },
191
+ { text: "🇺🇦 (+380)", value: "+380" },
192
+ { text: "🇦🇪 (+971)", value: "+971" },
193
+ { text: "🇬🇧 (+44)", value: "+44" },
194
+ { text: "🇺🇸 (+1)", value: "+1" },
195
+ { text: "🇺🇾 (+598)", value: "+598" },
196
+ { text: "🇺🇿 (+998)", value: "+998" },
197
+ { text: "🇻🇺 (+678)", value: "+678" },
198
+ { text: "🇻🇦 (+379)", value: "+379" },
199
+ { text: "🇻🇪 (+58)", value: "+58" },
200
+ { text: "🇻🇳 (+84)", value: "+84" },
201
+ { text: "🇾🇪 (+967)", value: "+967" },
202
+ { text: "🇿🇲 (+260)", value: "+260" },
203
+ { text: "🇿🇼 (+263)", value: "+263" },
204
+ ];
205
+ const Phone = ({ variant, color, name, values, onSelected, onChange, placeholder, validation, disabled, }) => {
206
+ // refs
207
+ const _input = useRef(null);
208
+ // states
209
+ const [_value, setValue] = useState("");
210
+ const [selected, setSelected] = useState(undefined);
211
+ // methods
212
+ const handleClick = () => {
213
+ const input = _input.current;
214
+ if (!input)
215
+ return;
216
+ const caret = input.selectionStart ?? 0;
217
+ input.setSelectionRange(caret, caret + 1);
218
+ };
219
+ const handleChange = (event) => {
220
+ if (disabled)
221
+ return;
222
+ const { value } = event.target;
223
+ setValue(value);
224
+ onChange?.({
225
+ ...event,
226
+ target: {
227
+ ...event.target,
228
+ name,
229
+ value: value.replace(/\D/g, ""),
230
+ },
231
+ });
232
+ };
233
+ // useEffects
234
+ useEffect(() => {
235
+ setValue(values.value);
236
+ setSelected(options.find((option) => option.value === values.option));
237
+ }, [values]);
238
+ return (React.createElement("div", { className: "ar-input-phone-wrapper" },
239
+ React.createElement(Select, { style: { width: 130 }, variant: "outlined", color: "light", options: options.sort((a, b) => Number(a.value.replace("+", "")) - Number(b.value.replace("+", ""))), value: selected, onChange: (option) => {
240
+ onSelected(option);
241
+ setSelected(option);
242
+ } }),
243
+ React.createElement(Input, { ref: _input, name: name, variant: variant, color: color, value: PhoneMask.FormatByMask(selected?.value, _value), type: "tel", inputMode: "decimal", onChange: handleChange, onClick: handleClick, placeholder: placeholder, validation: validation, disabled: disabled })));
244
+ };
245
+ export default Phone;
@@ -1,28 +1,6 @@
1
1
  import { Variants, Option, Status, Color } from "../../../libs/types";
2
2
  import { IBorder, IDisabled, IIcon, ISize, IColors, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
3
3
  export interface IMultiple {
4
- /**
5
- * Bileşenin durum (status) ayarlarını belirtir.
6
- *
7
- * - `color`: Genel durum rengini belirler. `Status` tipi ile tanımlanır (örneğin "success", "error" vb.).
8
- * - `selected`: Seçili öğelerin görünümüyle ilgili ayarlar.
9
- * - `variant`: Seçili öğenin stil varyantı (`Variants` tipi).
10
- * - `color`: Seçili öğenin durumu için renk (`Status` tipi).
11
- *
12
- * Örneğin;
13
- *
14
- * ```jsx
15
- * <Select
16
- * status={{
17
- * color: "warning",
18
- * selected: {
19
- * variant: "outlined",
20
- * color: "success",
21
- * },
22
- * }}
23
- * />
24
- * ```
25
- */
26
4
  status?: {
27
5
  color?: Color;
28
6
  selected?: {
@@ -30,112 +8,21 @@ export interface IMultiple {
30
8
  color?: Color;
31
9
  };
32
10
  };
33
- /**
34
- * Bileşenin seçtiği değerlerin listesi.
35
- *
36
- * Çoklu seçim için `Option` tipinden bir dizi kullanılır.
37
- */
38
11
  value: Option[];
39
- /**
40
- * Seçimler değiştiğinde çağrılan olaydır.
41
- *
42
- * Yeni seçili seçenekler `Option[]` olarak parametreye geçer.
43
- */
44
12
  onChange: (option: Option[]) => void;
45
- /**
46
- * Bileşenin çoklu seçim modunda olduğunu belirtir.
47
- *
48
- * Sabit `true` değeri ile tanımlanır.
49
- */
50
13
  multiple: true;
51
14
  }
52
15
  export interface ISingle {
53
- /**
54
- * Bileşenin durumunu belirtir.
55
- *
56
- * `Status` tipi ile tanımlanır (örneğin "success", "error", "warning" vb.).
57
- *
58
- * Örneğin;
59
- *
60
- * ```jsx
61
- * <Select status="success" />
62
- * ```
63
- */
64
16
  status?: Status;
65
- /**
66
- * Bileşenin seçili değeri.
67
- *
68
- * Tekli seçimde, `Option` tipi ya da seçilmemişse `undefined` olabilir.
69
- */
70
17
  value: Option | undefined;
71
- /**
72
- * Seçim değiştiğinde tetiklenen olaydır.
73
- *
74
- * Yeni seçilen değer `Option` tipi ya da seçilmemişse `undefined` olarak gelir.
75
- */
76
18
  onChange: (option: Option | undefined) => void;
77
- /**
78
- * Bileşenin çoklu seçim modunda olmadığını belirtir.
79
- *
80
- * `false` veya belirtilmemiş olabilir.
81
- */
82
19
  multiple?: false;
83
20
  }
84
21
  export type Props = {
85
- /**
86
- * Seçilebilir seçeneklerin listesi.
87
- *
88
- * `Option` tipi elemanlardan oluşan bir dizi olmalıdır.
89
- *
90
- * Örneğin;
91
- *
92
- * ```jsx
93
- * <Select options={[{label: "...", value: "..."}]} />
94
- * ```
95
- */
22
+ style?: React.CSSProperties | undefined;
96
23
  options: Option[];
97
- /**
98
- * Arama alanına bir metin girildiğinde tetiklenen olaydır.
99
- *
100
- * - `searchText`: Kullanıcının yazdığı arama metni.,
101
- *
102
- * Örneğin;
103
- *
104
- * ```jsx
105
- * <Select onSearch={(searchText) => console.log(searchText)} />
106
- * ```
107
- */
108
24
  onSearch?: (searchText: string) => void;
109
- /**
110
- * Bileşen üzerine tıklandığında tetiklenen olaydır.
111
- *
112
- * Örneğin;
113
- *
114
- * ```jsx
115
- * <Select onClick={() => {...}} />
116
- * ```
117
- */
118
25
  onClick?: () => void;
119
- /**
120
- * Yeni bir seçenek oluşturulduğunda tetiklenen olaydır.
121
- *
122
- * - `option`: Oluşturulan yeni `Option` nesnesi.
123
- *
124
- * Örneğin;
125
- *
126
- * ```jsx
127
- * <Select onCreate={(option) => console.log(option)} />
128
- * ```
129
- */
130
26
  onCreate?: (option: Option) => void;
131
- /**
132
- * Bileşenin içinde gösterilecek yer tutucu (placeholder) metni.
133
- *
134
- * Örneğin;
135
- *
136
- * ```jsx
137
- * <Select placeholder="..." />
138
- * ```
139
- */
140
27
  placeholder?: string;
141
28
  } & (IMultiple | ISingle) & IVariant & IColors & IBorder & IIcon & ISize & IUpperCase & IValidation & IDisabled;
@@ -6,7 +6,7 @@ import Chip from "../../data-display/chip";
6
6
  import Checkbox from "../checkbox";
7
7
  import Utils from "../../../libs/infrastructure/shared/Utils";
8
8
  import ReactDOM from "react-dom";
9
- const Select = ({ variant = "outlined", status, color, border = { radius: "sm" }, options, value, onChange, onSearch, onClick, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
9
+ const Select = ({ variant = "outlined", status, color, border = { radius: "sm" }, style, options, value, onChange, onSearch, onClick, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
10
10
  const _selectionClassName = ["selections"];
11
11
  // refs
12
12
  const _arSelect = useRef(null);
@@ -279,7 +279,7 @@ const Select = ({ variant = "outlined", status, color, border = { radius: "sm" }
279
279
  React.createElement("div", { className: "items" }, value.map((_value, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled", color: status?.selected?.color || status?.color, text: _value.text }))))),
280
280
  React.createElement("span", { ref: _placeholder, className: `placeholder ${value.length > 0 ? "visible" : "hidden"}` },
281
281
  validation ? "* " : "",
282
- placeholder))) : (React.createElement(Input, { ref: _singleInput, variant: variant, color: !Utils.IsNullOrEmpty(validation?.text) ? "red" : color,
282
+ placeholder))) : (React.createElement(Input, { ref: _singleInput, style: style, variant: variant, color: !Utils.IsNullOrEmpty(validation?.text) ? "red" : color,
283
283
  // status={!Utils.IsNullOrEmpty(validation?.text) ? "danger" : status}
284
284
  border: { radius: border.radius }, value: singleInputText, onClick: () => {
285
285
  onClick && onClick();
@@ -136,7 +136,8 @@ export const useValidation = function (data, params, step) {
136
136
  setError(key, Utils.StringFormat(s.message, s.value), param.step, index);
137
137
  }
138
138
  // Regexes
139
- const phoneRegex = /^((\+90|0)?([2-5]\d{2})\d{7}|\+[1-9]\d{7,14})$/;
139
+ // const phoneRegex = /^((\+90|0)?([2-5]\d{2})\d{7}|\+[1-9]\d{7,14})$/;
140
+ const phoneRegex = /^\d{7,14}$/;
140
141
  const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
141
142
  const ibanRegex = /^TR\d{24}$/;
142
143
  const accountNumberRegex = /^\d{6,16}$/;
@@ -0,0 +1,8 @@
1
+ declare class PhoneMask {
2
+ FormatByMask: (code: string, value: string) => string;
3
+ private GetMaskByCountry;
4
+ private countryMasks;
5
+ private GenerateMask;
6
+ }
7
+ declare const _default: PhoneMask;
8
+ export default _default;
@@ -0,0 +1,60 @@
1
+ class PhoneMask {
2
+ FormatByMask = (code, value) => {
3
+ const mask = this.GetMaskByCountry(code ?? "+90");
4
+ const digits = value.replace(/\D/g, "");
5
+ let result = "";
6
+ let i = 0;
7
+ for (const char of mask) {
8
+ if (char === "9") {
9
+ if (!digits[i])
10
+ break;
11
+ result += digits[i++];
12
+ }
13
+ else {
14
+ result += char;
15
+ }
16
+ }
17
+ return result;
18
+ };
19
+ GetMaskByCountry(countryCode, length) {
20
+ if (countryCode && this.countryMasks[countryCode]) {
21
+ return this.countryMasks[countryCode];
22
+ }
23
+ // fallback: length varsa ona göre üret, yoksa 10 ile varsayılan
24
+ return this.GenerateMask(length ?? 10);
25
+ }
26
+ countryMasks = {
27
+ "+90": "999 999 99 99", // Türkiye
28
+ "+1": "999 999 9999", // ABD / Kanada
29
+ "+44": "9999 999999", // İngiltere
30
+ "+49": "9999 9999999", // Almanya
31
+ "+33": "9 99 99 99 99", // Fransa
32
+ "+39": "999 999 9999", // İtalya
33
+ "+34": "999 999 999", // İspanya
34
+ "+351": "999 999 999", // Portekiz
35
+ "+31": "9 99999999", // Hollanda
36
+ "+32": "999 99 99 99", // Belçika
37
+ "+41": "99 999 99 99", // İsviçre
38
+ "+7": "999 999 99 99", // Rusya / Kazakistan
39
+ "+91": "99999 99999", // Hindistan
40
+ "+86": "999 9999 9999", // Çin
41
+ "+81": "99 9999 9999", // Japonya
42
+ "+82": "99 9999 9999", // Güney Kore
43
+ "+61": "9 9999 9999", // Avustralya
44
+ "+55": "99 99999 9999", // Brezilya
45
+ "+52": "999 999 9999", // Meksika
46
+ "+54": "99 9999 9999", // Arjantin
47
+ };
48
+ // length parametresi ile otomatik maske üret
49
+ GenerateMask(length) {
50
+ if (length <= 0)
51
+ return "";
52
+ const max = Math.min(length, 15); // E.164 max
53
+ const groups = max <= 10 ? [3, 3, max - 6] : [3, 3, 4, max - 10];
54
+ return groups
55
+ .filter((g) => g > 0)
56
+ .map((g) => "9".repeat(g))
57
+ .join(" ");
58
+ }
59
+ }
60
+ export default new PhoneMask();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.3.77",
3
+ "version": "0.3.79",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",