@sydsoft/base 1.49.0 → 1.50.0
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/package.json +2 -2
- package/_lib/baseFunctions.ts +0 -94
- package/_lib/inputMask.ts +0 -257
- package/_lib/listFunctions.ts +0 -106
- package/_lib/storage/cookies.ts +0 -39
- package/_lib/storage/encData.ts +0 -41
- package/_lib/storage/localStorage.ts +0 -67
- package/_lib/storage/sessionStorage.ts +0 -67
- package/_lib/useInterval.ts +0 -30
- package/alert/index.module.css +0 -119
- package/alert/index.tsx +0 -131
- package/box/Box.module.css +0 -153
- package/box/Box.tsx +0 -33
- package/box/BoxContent.tsx +0 -18
- package/box/BoxFooter.tsx +0 -25
- package/box/BoxHeader.tsx +0 -46
- package/box/index.ts +0 -10
- package/countDown/index.tsx +0 -116
- package/dateTime/index.ts +0 -79
- package/form/Button.tsx +0 -143
- package/form/Checkbox.tsx +0 -48
- package/form/Dialog.tsx +0 -109
- package/form/Form.tsx +0 -19
- package/form/FormOlustur.tsx +0 -105
- package/form/Input.tsx +0 -364
- package/form/Label.tsx +0 -20
- package/form/SearchableInput.tsx +0 -406
- package/form/UploadBase.tsx +0 -133
- package/form/index.ts +0 -10
- package/form/styles/Button.module.css +0 -145
- package/form/styles/Input.module.css +0 -221
- package/form/styles/Label.module.css +0 -31
- package/form/styles/SearchableInput.module.css +0 -80
- package/global.d.ts +0 -9
- package/grid/index.module.css +0 -805
- package/grid/index.tsx +0 -171
- package/icon/icons.tsx +0 -33
- package/icon/index.tsx +0 -95
- package/icon/mui.tsx +0 -5932
- package/index.ts +0 -21
- package/menu/index.module.css +0 -92
- package/menu/index.tsx +0 -143
- package/modal/index.module.css +0 -77
- package/modal/index.tsx +0 -106
- package/npm_recovery_codes.txt +0 -5
- package/popover/index.module.css +0 -89
- package/popover/index.tsx +0 -392
- package/tooltip/index.tsx +0 -216
- package/tsconfig.json +0 -24
package/form/Input.tsx
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author : izzetseydaoglu
|
|
3
|
-
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
-
* @version : 2026-01-21 21:35:48
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
|
-
import { convertForSEO, inputTumuBuyukCevir, inputTumuKucukCevir } from '../_lib/baseFunctions';
|
|
9
|
-
|
|
10
|
-
import { applyInputMask } from '../_lib/inputMask';
|
|
11
|
-
import { alert_add } from '../alert';
|
|
12
|
-
import { Dialog } from './Dialog';
|
|
13
|
-
import styles from './styles/Input.module.css';
|
|
14
|
-
|
|
15
|
-
type maskSettingsTranslation = {
|
|
16
|
-
[key: string]: {
|
|
17
|
-
pattern: any;
|
|
18
|
-
transform?: (value: string) => string;
|
|
19
|
-
optional?: boolean;
|
|
20
|
-
recursive?: boolean;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type maskSettings = {
|
|
25
|
-
clearIfNotMatch?: boolean;
|
|
26
|
-
reverse?: boolean;
|
|
27
|
-
translation?: maskSettingsTranslation;
|
|
28
|
-
selectOnFocus?: boolean;
|
|
29
|
-
onChange?: (maskedValue: string, cleanValue: string, targetInput: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export interface PropsInput {
|
|
33
|
-
componentRef?: any;
|
|
34
|
-
inputRef?: any;
|
|
35
|
-
className?: string;
|
|
36
|
-
id?: string;
|
|
37
|
-
name?: string;
|
|
38
|
-
value?: any;
|
|
39
|
-
label?: string;
|
|
40
|
-
loading?: boolean;
|
|
41
|
-
autoFocus?: boolean | undefined;
|
|
42
|
-
disabled?: boolean;
|
|
43
|
-
required?: boolean;
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
type?: 'text' | 'number' | 'email' | 'color' | 'date' | 'time' | 'datetime-local' | 'hidden' | 'file' | 'password' | 'tel' | 'search';
|
|
46
|
-
|
|
47
|
-
// - Select
|
|
48
|
-
select?: any[];
|
|
49
|
-
ilkSec?: boolean;
|
|
50
|
-
valueKey?: string;
|
|
51
|
-
labelKey?: string;
|
|
52
|
-
|
|
53
|
-
// - Textarea
|
|
54
|
-
multiline?: boolean;
|
|
55
|
-
rows?: number | undefined;
|
|
56
|
-
|
|
57
|
-
//--Fonk Props
|
|
58
|
-
onChange?: (e: any) => void;
|
|
59
|
-
onFocus?: (e: any) => void;
|
|
60
|
-
onBlur?: (e: any) => void;
|
|
61
|
-
onClick?: (e: any) => void;
|
|
62
|
-
onKeyPress?: (e: any) => void;
|
|
63
|
-
onKeyUp?: (e: any) => void;
|
|
64
|
-
onKeyDown?: (e: any) => void;
|
|
65
|
-
|
|
66
|
-
//--Ozel Props
|
|
67
|
-
propsComponent?: object | any;
|
|
68
|
-
propsInput?: object;
|
|
69
|
-
startAdornment?: any;
|
|
70
|
-
endAdornment?: any;
|
|
71
|
-
|
|
72
|
-
//--Ozel Fonksiyonlar
|
|
73
|
-
sadeceYazi?: boolean;
|
|
74
|
-
sadeceSayi?: boolean;
|
|
75
|
-
tumuBuyuk?: boolean;
|
|
76
|
-
tumuKucuk?: boolean;
|
|
77
|
-
seoCevir?: boolean;
|
|
78
|
-
dosyaNoGiris?: boolean;
|
|
79
|
-
fileNameGiris?: boolean;
|
|
80
|
-
dateGecmisKontrol?: boolean;
|
|
81
|
-
autoSelectText?: boolean;
|
|
82
|
-
|
|
83
|
-
//--Mask
|
|
84
|
-
mask?: string;
|
|
85
|
-
maskSettings?: maskSettings;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const Input: React.FC<PropsInput> = ({
|
|
89
|
-
componentRef,
|
|
90
|
-
inputRef,
|
|
91
|
-
className,
|
|
92
|
-
propsComponent,
|
|
93
|
-
propsInput,
|
|
94
|
-
id,
|
|
95
|
-
name,
|
|
96
|
-
value = '',
|
|
97
|
-
type,
|
|
98
|
-
label,
|
|
99
|
-
startAdornment,
|
|
100
|
-
endAdornment,
|
|
101
|
-
placeholder,
|
|
102
|
-
onChange,
|
|
103
|
-
onFocus,
|
|
104
|
-
onBlur,
|
|
105
|
-
onClick,
|
|
106
|
-
onKeyPress,
|
|
107
|
-
onKeyUp,
|
|
108
|
-
onKeyDown,
|
|
109
|
-
disabled = false,
|
|
110
|
-
required = false,
|
|
111
|
-
loading = false,
|
|
112
|
-
autoFocus = false,
|
|
113
|
-
select,
|
|
114
|
-
valueKey = 'value',
|
|
115
|
-
labelKey = 'label',
|
|
116
|
-
ilkSec = false,
|
|
117
|
-
multiline = false,
|
|
118
|
-
rows = 2,
|
|
119
|
-
sadeceYazi,
|
|
120
|
-
sadeceSayi,
|
|
121
|
-
tumuBuyuk,
|
|
122
|
-
tumuKucuk,
|
|
123
|
-
seoCevir,
|
|
124
|
-
dosyaNoGiris,
|
|
125
|
-
fileNameGiris,
|
|
126
|
-
dateGecmisKontrol,
|
|
127
|
-
autoSelectText,
|
|
128
|
-
mask = '',
|
|
129
|
-
maskSettings = {
|
|
130
|
-
clearIfNotMatch: true,
|
|
131
|
-
reverse: false, //Tersten doldurmaya başla, fiyatlar için geçerli
|
|
132
|
-
selectOnFocus: false
|
|
133
|
-
}
|
|
134
|
-
}) => {
|
|
135
|
-
const refMain = useRef<any>(null);
|
|
136
|
-
const refInput = useRef<any>(null);
|
|
137
|
-
const refLabel = useRef<any>(null);
|
|
138
|
-
|
|
139
|
-
const [inputFilled, setInputFilled] = useState<boolean>(value && value.toString().length > 0);
|
|
140
|
-
const [focus, setFocus] = useState<boolean>(false);
|
|
141
|
-
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (inputRef) inputRef.current = refInput.current;
|
|
144
|
-
if (componentRef) componentRef.current = refMain.current;
|
|
145
|
-
}, [componentRef, inputRef]);
|
|
146
|
-
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
autoSelectText && !select && refInput?.current && refInput.current.select();
|
|
149
|
-
}, [autoSelectText, select]);
|
|
150
|
-
|
|
151
|
-
useEffect(() => {
|
|
152
|
-
const filled = String(value) && value.toString().length > 0 ? true : false;
|
|
153
|
-
setInputFilled(filled);
|
|
154
|
-
filled && refMain?.current?.classList?.remove(styles.error);
|
|
155
|
-
}, [value]);
|
|
156
|
-
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
// if (type === "number") sadeceSayi = true; //TODO: sadeceSayi burada değiştirelemez ki!!!
|
|
159
|
-
if (select && ilkSec && (value === '' || value === null || value === undefined)) {
|
|
160
|
-
if (select.length) {
|
|
161
|
-
const ilkItem = select[0][valueKey] ? select[0][valueKey] : '';
|
|
162
|
-
onChange && onChange({ target: { name, value: ilkItem } });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}, [select]);
|
|
166
|
-
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
if (typeof window !== 'undefined' && mask?.length > 0 && refInput?.current) {
|
|
169
|
-
refInput.current?.setAttribute('autocomplete', 'off');
|
|
170
|
-
}
|
|
171
|
-
if (mask?.length > 0 && refInput?.current) {
|
|
172
|
-
const maskInstance = applyInputMask(refInput.current, mask, {
|
|
173
|
-
...maskSettings,
|
|
174
|
-
onChange: (masked: string, clean: string, e: any) => {
|
|
175
|
-
if (onChange) {
|
|
176
|
-
onChange({ target: { name, value: masked } });
|
|
177
|
-
}
|
|
178
|
-
if (maskSettings && maskSettings.onChange) {
|
|
179
|
-
maskSettings.onChange(masked, clean, e);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
maskInstance?.setValue(value ? value : null);
|
|
184
|
-
return () => maskInstance?.destroy();
|
|
185
|
-
}
|
|
186
|
-
}, [mask]);
|
|
187
|
-
|
|
188
|
-
const Change = useCallback(
|
|
189
|
-
(e: any) => {
|
|
190
|
-
if (tumuBuyuk) inputTumuBuyukCevir(e);
|
|
191
|
-
if (tumuKucuk) inputTumuKucukCevir(e);
|
|
192
|
-
if (seoCevir) convertForSEO(e);
|
|
193
|
-
setInputFilled(e.target.value.length > 0);
|
|
194
|
-
onChange ? onChange(e) : null;
|
|
195
|
-
},
|
|
196
|
-
[onChange, seoCevir, tumuBuyuk, tumuKucuk]
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
const Focus = useCallback(
|
|
200
|
-
(e: any) => {
|
|
201
|
-
onFocus ? onFocus(e) : null;
|
|
202
|
-
setFocus(true);
|
|
203
|
-
refMain?.current?.classList?.remove(styles.error);
|
|
204
|
-
},
|
|
205
|
-
[onFocus]
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const Blur = useCallback(
|
|
209
|
-
(e: any) => {
|
|
210
|
-
if (fileNameGiris && e.target.value !== '' && /[/\\?%*:|"'<>]/g.test(e.target.value)) {
|
|
211
|
-
e.target.value = e.target.value.replace(/[/\\?%*:|"'<>]/g, '-');
|
|
212
|
-
if (onChange) onChange(e);
|
|
213
|
-
alert_add({ type: 'warning', message: 'Lütfen dosya adındaki özel karakter değiştirildi.' });
|
|
214
|
-
}
|
|
215
|
-
if (dosyaNoGiris && e.target.value !== '' && !/^[1-2]\d{3}\/\d/.test(e.target.value)) {
|
|
216
|
-
e.target.value = '';
|
|
217
|
-
if (onChange) onChange(e);
|
|
218
|
-
alert_add({ type: 'error', message: 'Lütfen doğru bir dosya numarası giriniz. Örn: 2022/123' });
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (dateGecmisKontrol && e.target.value !== '') {
|
|
222
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
223
|
-
if (e.target.value < today) {
|
|
224
|
-
Dialog({
|
|
225
|
-
message: 'Geçmiş bir tarihi seçtiniz. Devam etmek istiyor musunuz?'
|
|
226
|
-
}).then((r) => {
|
|
227
|
-
if (!r) {
|
|
228
|
-
e.target.value = '';
|
|
229
|
-
if (onChange) onChange(e);
|
|
230
|
-
e.target.focus();
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (required) {
|
|
237
|
-
if (e.target.value === '') {
|
|
238
|
-
refMain?.current?.classList?.add(styles.error);
|
|
239
|
-
} else {
|
|
240
|
-
refMain?.current?.classList?.remove(styles.error);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (value !== e.target.value) {
|
|
245
|
-
onChange && onChange({ target: { name, value: e.target.value } });
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
onBlur ? onBlur(e) : null;
|
|
249
|
-
setFocus(false);
|
|
250
|
-
},
|
|
251
|
-
[fileNameGiris, dosyaNoGiris, dateGecmisKontrol, required, value, onBlur, onChange, name]
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
const Click = useCallback((e: any) => (onClick ? onClick(e) : null), [onClick]);
|
|
255
|
-
|
|
256
|
-
const KeyPress = useCallback(
|
|
257
|
-
(e: any) => {
|
|
258
|
-
if (sadeceYazi) {
|
|
259
|
-
const turkishLetters = /[ğüşıöçĞÜŞİÖÇ]/;
|
|
260
|
-
if (!(/[A-Za-z\s.]/.test(e.key) || turkishLetters.test(e.key))) {
|
|
261
|
-
e.preventDefault();
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if ((sadeceSayi || dosyaNoGiris) && (e.which < 48 || e.which > 57)) e.preventDefault();
|
|
266
|
-
if (dosyaNoGiris && e.which !== 8 && e.target.value.length === 4 && e.target.value.search('/') === -1) {
|
|
267
|
-
e.target.value = e.target.value + '/';
|
|
268
|
-
}
|
|
269
|
-
onKeyPress ? onKeyPress(e) : null;
|
|
270
|
-
},
|
|
271
|
-
[sadeceYazi, sadeceSayi, dosyaNoGiris, onKeyPress]
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const KeyUp = useCallback((e: any) => (onKeyUp ? onKeyUp(e) : null), [onKeyUp]);
|
|
275
|
-
|
|
276
|
-
const KeyDown = useCallback(
|
|
277
|
-
(e: any) => {
|
|
278
|
-
onKeyDown ? onKeyDown(e) : null;
|
|
279
|
-
},
|
|
280
|
-
[onKeyDown]
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const ortakProps = {
|
|
284
|
-
ref: refInput,
|
|
285
|
-
id,
|
|
286
|
-
name,
|
|
287
|
-
value,
|
|
288
|
-
autoFocus,
|
|
289
|
-
disabled,
|
|
290
|
-
required,
|
|
291
|
-
placeholder,
|
|
292
|
-
onChange: Change,
|
|
293
|
-
onFocus: Focus,
|
|
294
|
-
onBlur: Blur,
|
|
295
|
-
onClick: Click,
|
|
296
|
-
onKeyPress: KeyPress,
|
|
297
|
-
onKeyUp: KeyUp,
|
|
298
|
-
onKeyDown: KeyDown
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
let component;
|
|
302
|
-
if (select) {
|
|
303
|
-
component = (
|
|
304
|
-
<select className={`${styles.input} ${styles.select}`} {...ortakProps} {...propsInput}>
|
|
305
|
-
{ilkSec === false && <option value={''} />}
|
|
306
|
-
{select.map((item: any) => {
|
|
307
|
-
const value = item[valueKey];
|
|
308
|
-
const label = item[labelKey];
|
|
309
|
-
return (
|
|
310
|
-
<option key={value} value={value}>
|
|
311
|
-
{label ? label : value}
|
|
312
|
-
</option>
|
|
313
|
-
);
|
|
314
|
-
})}
|
|
315
|
-
</select>
|
|
316
|
-
);
|
|
317
|
-
} else if (multiline) {
|
|
318
|
-
component = <textarea className={`${styles.input} ${styles.textarea}`} rows={rows} {...ortakProps} {...propsInput} />;
|
|
319
|
-
} else {
|
|
320
|
-
component = <input className={`${styles.input}`} type={type} {...ortakProps} {...propsInput} />;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const classList = () => {
|
|
324
|
-
const list = ['sInputComponent', styles.component];
|
|
325
|
-
if (className) list.push(className);
|
|
326
|
-
if (label) {
|
|
327
|
-
list.push(styles.hidePlaceHolder);
|
|
328
|
-
}
|
|
329
|
-
// if (props.required && (value.length === 0 || !value)) list.push("error");
|
|
330
|
-
return list.join(' ');
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
useEffect(() => {
|
|
334
|
-
if (propsComponent && propsComponent.hasOwnProperty('style')) {
|
|
335
|
-
const background = propsComponent.style.background ? propsComponent.style.background : propsComponent.style.backgroundColor ? propsComponent.style.backgroundColor : null;
|
|
336
|
-
if (background && refLabel.current) {
|
|
337
|
-
refLabel.current.style.setProperty('--label-bg', background);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}, [propsComponent]);
|
|
341
|
-
|
|
342
|
-
return (
|
|
343
|
-
<div ref={refMain} className={classList()} data-disabled={disabled} {...propsComponent}>
|
|
344
|
-
{startAdornment && <div className={`adornment_start ${styles.adornment} ${styles.start}`}>{startAdornment}</div>}
|
|
345
|
-
|
|
346
|
-
<div className={`${styles.inputBase} ${inputFilled || focus || type == 'date' ? styles.open : ''}`}>
|
|
347
|
-
{component}
|
|
348
|
-
{label && (
|
|
349
|
-
<div ref={refLabel} className={`label ${styles.label}`}>
|
|
350
|
-
{label}
|
|
351
|
-
{required && <span className={styles.required}>*</span>}
|
|
352
|
-
</div>
|
|
353
|
-
)}
|
|
354
|
-
</div>
|
|
355
|
-
|
|
356
|
-
{(endAdornment || loading) && (
|
|
357
|
-
<div className={`adornment_end ${styles.adornment} ${styles.end}`}>
|
|
358
|
-
{endAdornment}
|
|
359
|
-
{loading && <div className={styles.loading} />}
|
|
360
|
-
</div>
|
|
361
|
-
)}
|
|
362
|
-
</div>
|
|
363
|
-
);
|
|
364
|
-
};
|
package/form/Label.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Tooltip } from '../tooltip';
|
|
4
|
-
import styles from './styles/Label.module.css';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Label: React.FC<Props> = memo(function FMemo({ required = false, children, ...other }) {
|
|
12
|
-
return (
|
|
13
|
-
<label className={styles.label} {...other}>
|
|
14
|
-
{children}
|
|
15
|
-
<Tooltip title={'Zorunlu Alan'}>
|
|
16
|
-
<span className={styles.required}>{required && '*'}</span>
|
|
17
|
-
</Tooltip>
|
|
18
|
-
</label>
|
|
19
|
-
);
|
|
20
|
-
});
|