@sydsoft/base 1.49.0 → 1.51.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.
Files changed (84) hide show
  1. package/_dist/_lib/baseFunctions.js +24 -11
  2. package/_dist/_lib/inputMask.js +7 -3
  3. package/_dist/_lib/listFunctions.js +7 -2
  4. package/_dist/_lib/storage/cookies.js +20 -12
  5. package/_dist/_lib/storage/encData.js +10 -5
  6. package/_dist/_lib/storage/localStorage.js +23 -14
  7. package/_dist/_lib/storage/sessionStorage.js +23 -14
  8. package/_dist/_lib/useInterval.js +8 -5
  9. package/_dist/alert/index.js +22 -13
  10. package/_dist/box/Box.js +12 -8
  11. package/_dist/box/BoxContent.js +9 -4
  12. package/_dist/box/BoxFooter.js +9 -5
  13. package/_dist/box/BoxHeader.js +10 -6
  14. package/_dist/box/index.js +7 -4
  15. package/_dist/countDown/index.js +17 -12
  16. package/_dist/dateTime/index.js +4 -1
  17. package/_dist/form/Button.js +24 -20
  18. package/_dist/form/Checkbox.js +11 -6
  19. package/_dist/form/Dialog.js +12 -8
  20. package/_dist/form/Form.js +7 -4
  21. package/_dist/form/FormOlustur.js +16 -12
  22. package/_dist/form/Input.js +49 -44
  23. package/_dist/form/Label.js +10 -6
  24. package/_dist/form/SearchableInput.js +47 -43
  25. package/_dist/form/UploadBase.js +16 -11
  26. package/_dist/form/index.js +12 -9
  27. package/_dist/grid/index.js +38 -30
  28. package/_dist/icon/icons.js +10 -7
  29. package/_dist/icon/index.js +13 -9
  30. package/_dist/icon/mui.js +2 -1
  31. package/_dist/index.js +22 -19
  32. package/_dist/menu/index.js +20 -16
  33. package/_dist/modal/index.js +16 -12
  34. package/_dist/popover/index.js +37 -33
  35. package/_dist/tooltip/index.js +8 -4
  36. package/package.json +3 -5
  37. package/_lib/baseFunctions.ts +0 -94
  38. package/_lib/inputMask.ts +0 -257
  39. package/_lib/listFunctions.ts +0 -106
  40. package/_lib/storage/cookies.ts +0 -39
  41. package/_lib/storage/encData.ts +0 -41
  42. package/_lib/storage/localStorage.ts +0 -67
  43. package/_lib/storage/sessionStorage.ts +0 -67
  44. package/_lib/useInterval.ts +0 -30
  45. package/alert/index.module.css +0 -119
  46. package/alert/index.tsx +0 -131
  47. package/box/Box.module.css +0 -153
  48. package/box/Box.tsx +0 -33
  49. package/box/BoxContent.tsx +0 -18
  50. package/box/BoxFooter.tsx +0 -25
  51. package/box/BoxHeader.tsx +0 -46
  52. package/box/index.ts +0 -10
  53. package/countDown/index.tsx +0 -116
  54. package/dateTime/index.ts +0 -79
  55. package/form/Button.tsx +0 -143
  56. package/form/Checkbox.tsx +0 -48
  57. package/form/Dialog.tsx +0 -109
  58. package/form/Form.tsx +0 -19
  59. package/form/FormOlustur.tsx +0 -105
  60. package/form/Input.tsx +0 -364
  61. package/form/Label.tsx +0 -20
  62. package/form/SearchableInput.tsx +0 -406
  63. package/form/UploadBase.tsx +0 -133
  64. package/form/index.ts +0 -10
  65. package/form/styles/Button.module.css +0 -145
  66. package/form/styles/Input.module.css +0 -221
  67. package/form/styles/Label.module.css +0 -31
  68. package/form/styles/SearchableInput.module.css +0 -80
  69. package/global.d.ts +0 -9
  70. package/grid/index.module.css +0 -805
  71. package/grid/index.tsx +0 -171
  72. package/icon/icons.tsx +0 -33
  73. package/icon/index.tsx +0 -95
  74. package/icon/mui.tsx +0 -5932
  75. package/index.ts +0 -21
  76. package/menu/index.module.css +0 -92
  77. package/menu/index.tsx +0 -143
  78. package/modal/index.module.css +0 -77
  79. package/modal/index.tsx +0 -106
  80. package/npm_recovery_codes.txt +0 -5
  81. package/popover/index.module.css +0 -89
  82. package/popover/index.tsx +0 -392
  83. package/tooltip/index.tsx +0 -216
  84. 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
- });