react-restyle-components 0.3.65 → 0.3.67

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 (35) hide show
  1. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.d.ts +100 -12
  2. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.d.ts.map +1 -1
  3. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.js +85 -51
  4. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.d.ts +108 -7
  5. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.d.ts.map +1 -1
  6. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.js +154 -60
  7. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.d.ts +104 -6
  8. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.d.ts.map +1 -1
  9. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.js +261 -71
  10. package/lib/src/core-components/src/components/Loader/loader.component.d.ts +13 -1
  11. package/lib/src/core-components/src/components/Loader/loader.component.d.ts.map +1 -1
  12. package/lib/src/core-components/src/components/Loader/loader.component.js +121 -3
  13. package/lib/src/core-components/src/components/check-box/checkBox.component.d.ts.map +1 -1
  14. package/lib/src/core-components/src/components/check-box/checkBox.component.js +2 -2
  15. package/lib/src/core-components/src/components/date-picker/date-picker.component.js +2 -2
  16. package/lib/src/core-components/src/components/radio/radio.component.js +2 -2
  17. package/lib/src/core-components/src/components/stepper/stepper.component.d.ts +54 -6
  18. package/lib/src/core-components/src/components/stepper/stepper.component.d.ts.map +1 -1
  19. package/lib/src/core-components/src/components/stepper/stepper.component.js +127 -19
  20. package/lib/src/core-components/src/components/timer/timer.component.js +2 -2
  21. package/lib/src/core-components/src/tc.global.css +7 -1
  22. package/lib/src/core-components/src/tc.module.css +1 -1
  23. package/package.json +1 -1
  24. package/lib/src/core-components/src/library/assets/svg/CheckedBox.svg +0 -14
  25. package/lib/src/core-components/src/library/assets/svg/DownArrow.svg +0 -14
  26. package/lib/src/core-components/src/library/assets/svg/UnCheckbox.svg +0 -3
  27. package/lib/src/core-components/src/library/assets/svg/UpArrow.svg +0 -14
  28. package/lib/src/core-components/src/library/assets/svg/checkedRadio.svg +0 -13
  29. package/lib/src/core-components/src/library/assets/svg/datePicker.svg +0 -3
  30. package/lib/src/core-components/src/library/assets/svg/index.d.ts +0 -10
  31. package/lib/src/core-components/src/library/assets/svg/index.d.ts.map +0 -1
  32. package/lib/src/core-components/src/library/assets/svg/index.js +0 -28
  33. package/lib/src/core-components/src/library/assets/svg/timer copy.svg +0 -3
  34. package/lib/src/core-components/src/library/assets/svg/timer.svg +0 -3
  35. package/lib/src/core-components/src/library/assets/svg/uncheckRadio.svg +0 -3
@@ -1,108 +1,298 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback } from 'react';
3
+ import { Icon } from '../../';
3
4
  import s from '../../../tc.module.css';
4
5
  import { cn } from '../../../utils';
5
- const LI_ELEMENT_HEIGHT = 34;
6
- export const Autocomplete = ({ value = '', onValueChange, options = [], }) => {
7
- const [activeOption, setActiveOption] = useState(value === '' || options.indexOf(value) === -1 ? 0 : options.indexOf(value));
6
+ const DEFAULT_ITEM_HEIGHT = 34;
7
+ export const Autocomplete = ({ value = '', onValueChange, options = [], filterConfig = {}, displayConfig = {}, keyboardConfig = {}, uiConfig = {}, hasError = false, disabled = false, name, className, style, inputClassName, onInputValueChange, onOpen, onClose, onSelect, autoFocus = false, }) => {
8
+ // Merge configs with defaults
9
+ const { enabled: filterEnabled = true, caseSensitive = false, filterFn, minCharacters = 0, } = filterConfig;
10
+ const { renderOption, renderEmptyState, highlightActive = true, activeOptionClassName, optionClassName, } = displayConfig;
11
+ const { enabled: keyboardEnabled = true, selectKeys = ['Enter'], closeKeys = ['Escape'], enterToSelect = true, escapeToClose = true, } = keyboardConfig;
12
+ const { placeholder = 'Search...', emptyStateMessage = 'Not Found Result!!', itemHeight = DEFAULT_ITEM_HEIGHT, maxHeight, zIndex = 999, showOnFocus = true, showOnClick = true, autoSelectFirst = true, } = uiConfig;
13
+ // Helper to get option label (moved outside to avoid dependency issues)
14
+ const getOptionLabel = useCallback((option) => {
15
+ return typeof option === 'string' ? option : option.label;
16
+ }, []);
17
+ // Helper to get option value (moved outside to avoid dependency issues)
18
+ const getOptionValue = useCallback((option) => {
19
+ return typeof option === 'string' ? option : String(option.value);
20
+ }, []);
21
+ // Find initial active option index
22
+ const getInitialActiveIndex = useCallback(() => {
23
+ if (!value || options.length === 0)
24
+ return 0;
25
+ const index = options.findIndex((opt) => getOptionValue(opt) === value || getOptionLabel(opt) === value);
26
+ return index !== -1 ? index : 0;
27
+ }, [value, options, getOptionValue, getOptionLabel]);
28
+ const [activeOption, setActiveOption] = useState(() => {
29
+ if (!value || options.length === 0)
30
+ return 0;
31
+ const index = options.findIndex((opt) => (typeof opt === 'string' ? opt : String(opt.value)) === value ||
32
+ (typeof opt === 'string' ? opt : opt.label) === value);
33
+ return index !== -1 ? index : 0;
34
+ });
8
35
  const [filteredOptions, setFilteredOptions] = useState(options);
9
36
  const [shouldShowList, setShouldShowList] = useState(false);
10
37
  const [searchValue, setSearchValue] = useState(value);
11
38
  const inputRef = useRef(null);
12
39
  const listRef = useRef(null);
40
+ // Filter function
41
+ const filterOptions = useCallback((searchValue) => {
42
+ if (!filterEnabled)
43
+ return options;
44
+ if (searchValue.length < minCharacters)
45
+ return options;
46
+ if (filterFn) {
47
+ return options.filter((option) => filterFn(option, searchValue));
48
+ }
49
+ const lowerSearch = caseSensitive
50
+ ? searchValue
51
+ : searchValue.toLowerCase();
52
+ return options.filter((option) => {
53
+ const label = getOptionLabel(option);
54
+ const matchText = caseSensitive ? label : label.toLowerCase();
55
+ return matchText.indexOf(lowerSearch) > -1;
56
+ });
57
+ }, [
58
+ options,
59
+ filterEnabled,
60
+ caseSensitive,
61
+ filterFn,
62
+ minCharacters,
63
+ getOptionLabel,
64
+ ]);
13
65
  const onInputChange = useCallback((event) => {
14
66
  const input = event.target.value;
15
- if (input != '') {
16
- const newFilteredOptions = options.filter((option) => option.toLowerCase().indexOf(input.toLowerCase()) > -1);
17
- setFilteredOptions(newFilteredOptions);
18
- }
19
- else {
20
- setFilteredOptions(options);
67
+ // Call onInputValueChange callback
68
+ if (onInputValueChange) {
69
+ onInputValueChange(input);
21
70
  }
71
+ // Filter options
72
+ const filtered = filterOptions(input);
73
+ setFilteredOptions(filtered);
22
74
  setActiveOption(0);
23
75
  setShouldShowList(true);
24
76
  setSearchValue(input);
25
- }, [
26
- setActiveOption,
27
- setFilteredOptions,
28
- setShouldShowList,
29
- setSearchValue,
30
- onValueChange,
31
- ]);
32
- const onOptionClick = useCallback((event) => {
33
- const symbol = event.currentTarget.innerText || event.currentTarget.textContent || '';
77
+ // Auto-select first option if enabled
78
+ if (autoSelectFirst && filtered.length > 0) {
79
+ onValueChange(filtered[0]);
80
+ }
81
+ }, [filterOptions, onInputValueChange, onValueChange, autoSelectFirst]);
82
+ const handleOptionSelect = useCallback((option, index) => {
83
+ const label = getOptionLabel(option);
34
84
  setShouldShowList(false);
35
85
  setActiveOption(0);
36
86
  setFilteredOptions([]);
37
- setSearchValue(symbol);
38
- onValueChange(symbol);
39
- }, [
40
- setShouldShowList,
41
- setActiveOption,
42
- setFilteredOptions,
43
- setSearchValue,
44
- onValueChange,
45
- ]);
87
+ setSearchValue(label);
88
+ onValueChange(option);
89
+ if (onSelect) {
90
+ onSelect(option);
91
+ }
92
+ if (onClose) {
93
+ onClose();
94
+ }
95
+ }, [onValueChange, onSelect, onClose]);
96
+ const onOptionClick = useCallback((event) => {
97
+ const index = parseInt(event.currentTarget.getAttribute('data-index') || '0', 10);
98
+ const option = filteredOptions[index];
99
+ if (option) {
100
+ handleOptionSelect(option, index);
101
+ }
102
+ }, [filteredOptions, handleOptionSelect]);
46
103
  const onKeyDown = useCallback((event) => {
47
- let selectedItem = '';
48
- if (event.keyCode === 38) {
49
- // arrow up
104
+ if (!keyboardEnabled)
105
+ return;
106
+ const key = event.key;
107
+ const keyCode = event.keyCode;
108
+ // Arrow Up
109
+ if (keyCode === 38 || key === 'ArrowUp') {
50
110
  event.preventDefault();
51
- if (activeOption === 0) {
52
- return;
53
- }
54
- else {
55
- selectedItem = filteredOptions[activeOption - 1];
56
- setSearchValue(filteredOptions[activeOption - 1]);
57
- setActiveOption(activeOption - 1);
111
+ if (activeOption > 0) {
112
+ const newIndex = activeOption - 1;
113
+ const option = filteredOptions[newIndex];
114
+ setActiveOption(newIndex);
115
+ setSearchValue(getOptionLabel(option));
58
116
  listRef.current?.scroll({
59
- top: LI_ELEMENT_HEIGHT * (activeOption - 1),
117
+ top: itemHeight * newIndex,
118
+ behavior: 'smooth',
60
119
  });
61
120
  }
121
+ return;
62
122
  }
63
- else if (event.keyCode === 40) {
64
- // arrow down
123
+ // Arrow Down
124
+ if (keyCode === 40 || key === 'ArrowDown') {
65
125
  event.preventDefault();
66
- if (activeOption === filteredOptions.length - 1) {
67
- return;
68
- }
69
- else {
70
- selectedItem = filteredOptions[activeOption + 1];
71
- setSearchValue(filteredOptions[activeOption + 1]);
72
- setActiveOption(activeOption + 1);
126
+ if (activeOption < filteredOptions.length - 1) {
127
+ const newIndex = activeOption + 1;
128
+ const option = filteredOptions[newIndex];
129
+ setActiveOption(newIndex);
130
+ setSearchValue(getOptionLabel(option));
73
131
  listRef.current?.scroll({
74
- top: LI_ELEMENT_HEIGHT * (activeOption + 1),
132
+ top: itemHeight * newIndex,
133
+ behavior: 'smooth',
75
134
  });
76
135
  }
136
+ return;
137
+ }
138
+ // Enter to select
139
+ if ((keyCode === 13 || key === 'Enter') && enterToSelect) {
140
+ event.preventDefault();
141
+ if (filteredOptions.length > 0 && activeOption >= 0) {
142
+ const option = filteredOptions[activeOption];
143
+ handleOptionSelect(option, activeOption);
144
+ }
145
+ return;
77
146
  }
78
- if (Object.keys(selectedItem)?.length > 0) {
79
- onValueChange(selectedItem);
147
+ // Escape to close
148
+ if ((keyCode === 27 || key === 'Escape') && escapeToClose) {
149
+ event.preventDefault();
150
+ setShouldShowList(false);
151
+ if (onClose) {
152
+ onClose();
153
+ }
154
+ return;
155
+ }
156
+ // Other select keys
157
+ if (selectKeys.includes(key) &&
158
+ filteredOptions.length > 0 &&
159
+ activeOption >= 0) {
160
+ event.preventDefault();
161
+ const option = filteredOptions[activeOption];
162
+ handleOptionSelect(option, activeOption);
163
+ }
164
+ // Close keys
165
+ if (closeKeys.includes(key)) {
166
+ event.preventDefault();
167
+ setShouldShowList(false);
168
+ if (onClose) {
169
+ onClose();
170
+ }
80
171
  }
81
172
  }, [
82
- setActiveOption,
83
- setSearchValue,
84
- filteredOptions,
173
+ keyboardEnabled,
85
174
  activeOption,
86
- onValueChange,
175
+ filteredOptions,
176
+ itemHeight,
177
+ enterToSelect,
178
+ escapeToClose,
179
+ selectKeys,
180
+ closeKeys,
181
+ handleOptionSelect,
182
+ onClose,
87
183
  ]);
184
+ const handleInputFocus = useCallback(() => {
185
+ if (showOnFocus && !shouldShowList) {
186
+ setShouldShowList(true);
187
+ if (onOpen) {
188
+ onOpen();
189
+ }
190
+ }
191
+ }, [showOnFocus, shouldShowList, onOpen]);
192
+ const handleInputClick = useCallback(() => {
193
+ if (showOnClick && !shouldShowList) {
194
+ setShouldShowList(true);
195
+ if (onOpen) {
196
+ onOpen();
197
+ }
198
+ }
199
+ }, [showOnClick, shouldShowList, onOpen]);
88
200
  const renderList = () => {
89
- return (_jsx(_Fragment, { children: shouldShowList ? (_jsx(_Fragment, { children: _jsx("div", { className: cn(s['flex'], s['absolute'], s['rounded-sm'], s['w-full']), style: { zIndex: 999 }, children: filteredOptions?.length > 0 ? (_jsx("ul", { role: "list", className: cn(s['flex'], s['flex-col'], s['gap-1'], s['bg-gray-200'], s['w-full']), id: "list", ref: listRef, children: filteredOptions?.map((option, index) => {
90
- let className = cn(s['flex'], s['gap-2'], s['p-2']);
91
- if (index === activeOption) {
92
- className = cn(className, s['font-bold']);
93
- }
94
- return (_jsx("li", { className: className, role: "listitem", onClick: onOptionClick, children: option }, index));
95
- }) })) : (_jsx("div", { className: cn(s['flex'], s['bg-gray-200'], s['w-full'], s['p-2']), children: _jsx("span", { children: "Not Found Result!!" }) })) }) })) : (_jsx(_Fragment, {})) }));
201
+ if (!shouldShowList)
202
+ return null;
203
+ return (_jsxs("div", { className: cn(s['absolute'], s['w-full'], s['mt-1'], s['rounded-lg'], s['bg-white'], s['border'], s['border-gray-200'], s['shadow-lg'], s['overflow-hidden'], 'animate-fade-in'), style: {
204
+ zIndex,
205
+ animation: 'fadeIn 0.15s ease-out',
206
+ transformOrigin: 'top',
207
+ }, children: [_jsx("style", { children: `
208
+ @keyframes fadeIn {
209
+ from {
210
+ opacity: 0;
211
+ transform: translateY(-8px) scale(0.98);
212
+ }
213
+ to {
214
+ opacity: 1;
215
+ transform: translateY(0) scale(1);
216
+ }
217
+ }
218
+ ` }), filteredOptions.length > 0 ? (_jsx("ul", { role: "listbox", className: cn(s['flex'], s['flex-col'], s['py-1'], s['w-full'], s['overflow-y-auto'], s['overflow-x-hidden']), id: "autocomplete-list", ref: listRef, style: {
219
+ maxHeight: maxHeight || '300px',
220
+ scrollbarWidth: 'thin',
221
+ }, children: filteredOptions.map((option, index) => {
222
+ const isActive = highlightActive && index === activeOption;
223
+ let itemClassName = cn(s['flex'], s['items-center'], s['px-4'], s['py-3'], s['cursor-pointer'], s['text-sm'], s['transition-all'], s['duration-150'], s['ease-in-out'], optionClassName, 'hover:bg-blue-50', 'hover:text-blue-700');
224
+ if (isActive && highlightActive) {
225
+ itemClassName = cn(itemClassName, s['bg-blue-50'], s['text-blue-700'], s['font-medium'], 'border-l-4', 'border-blue-500', activeOptionClassName);
226
+ }
227
+ return (_jsx("li", { className: itemClassName, role: "option", "aria-selected": isActive, id: `autocomplete-option-${index}`, "data-index": index, onClick: onOptionClick, onMouseEnter: () => setActiveOption(index), style: {
228
+ transition: 'background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease',
229
+ }, children: renderOption ? (renderOption(option, index, isActive)) : (_jsx("span", { className: cn(s['text-gray-700'], s['select-none']), children: getOptionLabel(option) })) }, index));
230
+ }) })) : (_jsx("div", { className: cn(s['flex'], s['flex-col'], s['items-center'], s['justify-center'], s['py-8'], s['px-4'], s['text-center']), children: renderEmptyState ? (renderEmptyState()) : (_jsxs(_Fragment, { children: [_jsx(Icon, { nameIcon: "FaSearch", propsIcon: {
231
+ size: 32,
232
+ color: '#9ca3af',
233
+ } }), _jsx("p", { className: cn(s['mt-3'], s['text-sm'], s['font-medium'], s['text-gray-500']), children: emptyStateMessage }), _jsx("p", { className: cn(s['mt-1'], s['text-xs'], s['text-gray-400']), children: "Try adjusting your search" })] })) }))] }));
96
234
  };
235
+ // Update filtered options when options change
97
236
  useEffect(() => {
98
- // this only works on click when inside timeout
99
- setTimeout(() => {
100
- inputRef.current?.select();
101
- }, 0);
102
- filteredOptions[0] && onValueChange(filteredOptions[0]);
103
- // setShouldShowList(true);
104
- }, []);
105
- return (_jsx(_Fragment, { children: _jsxs("div", { className: cn(s['flex'], s['flex-col'], s['relative']), children: [_jsx("div", { className: cn(s['flex'], s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md']), children: _jsx("input", { type: "text", role: "input", name: "autocomplete-input", className: cn(s['flex'], s['focus:outline-none']), placeholder: "Search...", onChange: onInputChange, onKeyDown: onKeyDown, value: searchValue, ref: inputRef, onClick: () => {
106
- setShouldShowList(true);
107
- } }) }), _jsx("div", { className: cn(s['flex']), children: renderList() })] }) }));
237
+ const filtered = filterOptions(searchValue);
238
+ setFilteredOptions(filtered);
239
+ // Update active option if current value is not in filtered options
240
+ if (filtered.length > 0) {
241
+ const currentIndex = filtered.findIndex((opt) => getOptionValue(opt) === value || getOptionLabel(opt) === value);
242
+ if (currentIndex !== -1 && currentIndex !== activeOption) {
243
+ setActiveOption(currentIndex);
244
+ }
245
+ }
246
+ }, [options, searchValue, filterOptions, value, activeOption]);
247
+ // Auto-focus and auto-select first option on mount
248
+ useEffect(() => {
249
+ if (autoFocus) {
250
+ setTimeout(() => {
251
+ inputRef.current?.focus();
252
+ inputRef.current?.select();
253
+ }, 0);
254
+ }
255
+ if (autoSelectFirst && filteredOptions.length > 0 && !value) {
256
+ onValueChange(filteredOptions[0]);
257
+ }
258
+ }, [autoFocus, autoSelectFirst, filteredOptions, value, onValueChange]);
259
+ // Update search value when value prop changes
260
+ useEffect(() => {
261
+ if (value !== searchValue) {
262
+ const matchingOption = options.find((opt) => getOptionValue(opt) === value || getOptionLabel(opt) === value);
263
+ if (matchingOption) {
264
+ setSearchValue(getOptionLabel(matchingOption));
265
+ }
266
+ else {
267
+ setSearchValue(value);
268
+ }
269
+ }
270
+ }, [value, options, searchValue]);
271
+ return (_jsxs("div", { className: cn(s['flex'], s['flex-col'], s['relative'], s['w-full'], className), style: style, children: [_jsx("div", { className: cn(s['flex'], s['items-center'], s['relative'], s['w-full'], s['bg-white'], s['border'], s['rounded-lg'], s['shadow-sm'], s['transition-all'], s['duration-200'], s['ease-in-out'], {
272
+ [s['border-red-500']]: hasError,
273
+ [s['border-gray-300']]: !hasError && !shouldShowList,
274
+ 'border-blue-500': !hasError && shouldShowList,
275
+ 'ring-2': !hasError && shouldShowList,
276
+ 'ring-blue-200': !hasError && shouldShowList,
277
+ [s['opacity-50']]: disabled,
278
+ [s['cursor-not-allowed']]: disabled,
279
+ 'hover:border-gray-400': !hasError && !disabled && !shouldShowList,
280
+ }), style: {
281
+ boxShadow: shouldShowList && !hasError
282
+ ? '0 0 0 3px rgba(59, 130, 246, 0.1)'
283
+ : '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
284
+ }, children: _jsxs("div", { className: cn(s['flex'], s['items-center'], s['px-3'], s['py-2']), children: [_jsx("div", { className: cn(s['mr-2'], s['flex-shrink-0']), children: _jsx(Icon, { nameIcon: "FaSearch", propsIcon: {
285
+ size: 18,
286
+ color: shouldShowList ? '#3b82f6' : '#9ca3af',
287
+ } }) }), _jsx("input", { type: "text", role: "combobox", "aria-autocomplete": "list", "aria-expanded": shouldShowList, "aria-controls": "autocomplete-list", "aria-activedescendant": shouldShowList && activeOption >= 0
288
+ ? `autocomplete-option-${activeOption}`
289
+ : undefined, name: name || 'autocomplete-input', className: cn(s['flex'], s['flex-1'], s['w-full'], s['bg-transparent'], s['text-sm'], s['text-gray-700'], s['placeholder-gray-400'], s['focus:outline-none'], s['border-none'], s['focus:ring-0'], inputClassName), placeholder: placeholder, onChange: onInputChange, onKeyDown: onKeyDown, onFocus: handleInputFocus, onClick: handleInputClick, value: searchValue, ref: inputRef, disabled: disabled, autoComplete: "off", style: {
290
+ cursor: disabled ? 'not-allowed' : 'text',
291
+ } }), _jsx("div", { className: cn(s['ml-2'], s['flex-shrink-0']), style: { transition: 'transform 0.2s ease' }, children: shouldShowList ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
292
+ size: 16,
293
+ color: '#3b82f6',
294
+ } })) : (_jsx(Icon, { nameIcon: "FaChevronDown", propsIcon: {
295
+ size: 16,
296
+ color: '#9ca3af',
297
+ } })) })] }) }), renderList()] }));
108
298
  };
@@ -1,6 +1,18 @@
1
+ export type LoaderVariant = 'spinner' | 'dots' | 'bars' | 'pulse';
2
+ export type LoaderSize = 'sm' | 'md' | 'lg';
1
3
  export interface LoadingAnimateSpinProps {
4
+ /** Wrapper className for positioning */
2
5
  classWarper?: string;
6
+ /** Additional className for the loader element */
3
7
  className?: string;
8
+ /** Variant of loader: spinner, dots, bars, or pulse */
9
+ variant?: LoaderVariant;
10
+ /** Size of the loader: sm, md, or lg */
11
+ size?: LoaderSize;
12
+ /** Color variant - uses CSS classes from tc.module.css */
13
+ color?: 'blue' | 'green' | 'gray' | 'primary';
14
+ /** Accessibility label */
15
+ 'aria-label'?: string;
4
16
  }
5
- export declare const LoadingAnimateSpin: ({ classWarper, className, }: LoadingAnimateSpinProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const LoadingAnimateSpin: ({ classWarper, className, variant, size, color, "aria-label": ariaLabel, }: LoadingAnimateSpinProps) => import("react/jsx-runtime").JSX.Element;
6
18
  //# sourceMappingURL=loader.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/Loader/loader.component.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,gCAG5B,uBAAuB,4CAwBzB,CAAC"}
1
+ {"version":3,"file":"loader.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/Loader/loader.component.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,wCAAwC;IACxC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuCD,eAAO,MAAM,kBAAkB,+EAO5B,uBAAuB,4CAsJzB,CAAC"}
@@ -1,6 +1,124 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import s from '../../tc.module.css';
3
3
  import { cn } from '../../utils';
4
- export const LoadingAnimateSpin = ({ classWarper = '', className = '', }) => {
5
- return (_jsx("div", { className: cn(s.absolute, s['justify-center'], s['items-center'], classWarper), children: _jsx("div", { className: cn(s['w-10'], s['h-10'], s['border-t-2'], s['border-b-2'], s['border-blue-500'], s['rounded-full'], s['animate-spin'], className) }) }));
4
+ const sizeClasses = {
5
+ sm: {
6
+ wrapper: cn(s['w-4'], s['h-4']),
7
+ spinner: cn(s['w-4'], s['h-4']),
8
+ dots: cn(s['w-1'], s['h-1']),
9
+ bars: cn(s['w-1'], s['h-6']),
10
+ pulse: cn(s['w-4'], s['h-4']),
11
+ },
12
+ md: {
13
+ wrapper: cn(s['w-8'], s['h-8']),
14
+ spinner: cn(s['w-8'], s['h-8']),
15
+ dots: cn(s['w-2'], s['h-2']),
16
+ bars: cn(s['w-1'], s['h-8']),
17
+ pulse: cn(s['w-8'], s['h-8']),
18
+ },
19
+ lg: {
20
+ wrapper: cn(s['w-10'], s['h-10']),
21
+ spinner: cn(s['w-10'], s['h-10']),
22
+ dots: cn(s['w-3'], s['h-3']),
23
+ bars: cn(s['w-2'], s['h-10']),
24
+ pulse: cn(s['w-10'], s['h-10']),
25
+ },
26
+ };
27
+ const getColorValue = (color) => {
28
+ const colors = {
29
+ blue: 'rgb(59 130 246)',
30
+ green: 'rgb(34 197 94)',
31
+ gray: 'rgb(156 163 175)',
32
+ primary: 'rgb(59 130 246)',
33
+ };
34
+ return colors[color] || colors.blue;
35
+ };
36
+ export const LoadingAnimateSpin = ({ classWarper = '', className = '', variant = 'spinner', size = 'md', color = 'blue', 'aria-label': ariaLabel = 'Loading', }) => {
37
+ const sizeConfig = sizeClasses[size];
38
+ const renderSpinner = () => {
39
+ const colorValue = getColorValue(color);
40
+ return (_jsx("div", { className: cn(sizeConfig.spinner, s['rounded-full'], className), style: {
41
+ borderWidth: '2px',
42
+ borderStyle: 'solid',
43
+ borderTopColor: colorValue,
44
+ borderRightColor: colorValue,
45
+ borderBottomColor: 'transparent',
46
+ borderLeftColor: 'transparent',
47
+ animation: 'spin 1s linear infinite',
48
+ }, "aria-label": ariaLabel, role: "status" }));
49
+ };
50
+ const renderDots = () => {
51
+ const colorValue = getColorValue(color);
52
+ return (_jsx("div", { className: cn(s['flex'], s['gap-2'], s['items-center'], className), "aria-label": ariaLabel, role: "status", children: [0, 1, 2].map((i) => (_jsx("div", { className: cn(sizeConfig.dots, s['rounded-full']), style: {
53
+ backgroundColor: colorValue,
54
+ animation: `bounce 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite`,
55
+ animationDelay: `${i * 0.16}s`,
56
+ animationFillMode: 'both',
57
+ } }, i))) }));
58
+ };
59
+ const renderBars = () => {
60
+ const colorValue = getColorValue(color);
61
+ return (_jsx("div", { className: cn(s['flex'], s['gap-1'], s['items-center'], className), "aria-label": ariaLabel, role: "status", children: [0, 1, 2].map((i) => (_jsx("div", { className: cn(sizeConfig.bars, s.rounded), style: {
62
+ backgroundColor: colorValue,
63
+ borderRadius: '0.125rem',
64
+ animation: `pulse 1.2s ease-in-out infinite`,
65
+ animationDelay: `${i * 0.15}s`,
66
+ animationFillMode: 'both',
67
+ } }, i))) }));
68
+ };
69
+ const renderPulse = () => {
70
+ const colorValue = getColorValue(color);
71
+ return (_jsx("div", { className: cn(sizeConfig.pulse, s['rounded-full'], className), style: {
72
+ backgroundColor: colorValue,
73
+ animation: `pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite`,
74
+ animationFillMode: 'both',
75
+ }, "aria-label": ariaLabel, role: "status" }));
76
+ };
77
+ const renderLoader = () => {
78
+ switch (variant) {
79
+ case 'dots':
80
+ return renderDots();
81
+ case 'bars':
82
+ return renderBars();
83
+ case 'pulse':
84
+ return renderPulse();
85
+ case 'spinner':
86
+ default:
87
+ return renderSpinner();
88
+ }
89
+ };
90
+ return (_jsxs("div", { className: cn(s['absolute'], s['inset-0'], s['flex'], s['justify-center'], s['items-center'], classWarper), children: [_jsx("style", { children: `
91
+ @keyframes spin {
92
+ from {
93
+ transform: rotate(0deg);
94
+ }
95
+ to {
96
+ transform: rotate(360deg);
97
+ }
98
+ }
99
+ @keyframes pulse {
100
+ 0% {
101
+ opacity: 1;
102
+ transform: scale(1);
103
+ }
104
+ 50% {
105
+ opacity: 0.5;
106
+ transform: scale(0.95);
107
+ }
108
+ 100% {
109
+ opacity: 1;
110
+ transform: scale(1);
111
+ }
112
+ }
113
+ @keyframes bounce {
114
+ 0%, 100% {
115
+ transform: translateY(0) scale(1);
116
+ opacity: 1;
117
+ }
118
+ 50% {
119
+ transform: translateY(-10px) scale(1.1);
120
+ opacity: 0.8;
121
+ }
122
+ }
123
+ ` }), renderLoader()] }));
6
124
  };
@@ -1 +1 @@
1
- {"version":3,"file":"checkBox.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/check-box/checkBox.component.tsx"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,QAAQ,wDAOlB,aAAa,4CAuCf,CAAC"}
1
+ {"version":3,"file":"checkBox.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/check-box/checkBox.component.tsx"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,QAAQ,wDAOlB,aAAa,4CAoCf,CAAC"}
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import s from '../../tc.module.css';
4
4
  import { cn } from '../../utils';
5
- import { UnCheckbox, CheckedBox } from '../../library/assets/svg';
6
5
  import { InputWrapper } from '../Form/form.component';
6
+ import { Icon } from '..';
7
7
  export const CheckBox = ({ title = 'Banks', data = [{ title: 'SBI Bank', checked: false }], className, fill = '#E7503D', stroke = '#E7503D', onChange, }) => {
8
8
  const [list, setList] = useState(data);
9
9
  const width = 20;
@@ -16,5 +16,5 @@ export const CheckBox = ({ title = 'Banks', data = [{ title: 'SBI Bank', checked
16
16
  });
17
17
  setList(result);
18
18
  onChange(result?.filter((item) => item.checked));
19
- }, children: [_jsx("div", { className: cn(s.flex, s['mt-1']), children: item.checked ? (_jsx(CheckedBox, { width: width, height: width, fill: fill, stroke: stroke })) : (_jsx(UnCheckbox, { width: width, height: width })) }), _jsx("span", { children: item?.title })] }, index))) }));
19
+ }, children: [_jsx("div", { className: cn(s.flex, s['gap-2']), children: item.checked ? (_jsx(Icon, { nameIcon: "ImCheckboxChecked" })) : (_jsx(Icon, { nameIcon: "ImCheckboxUnchecked" })) }), _jsx("span", { className: cn(s['text-sm'], s['font-medium'], s['ml-2']), children: item?.title })] }, index))) }));
20
20
  };
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, forwardRef } from 'react';
3
3
  import DatePicker from 'react-datepicker';
4
4
  import 'react-datepicker/dist/react-datepicker.css';
5
- import { DatePickerSvg } from '../../library/assets/svg';
5
+ import { Icon } from '..';
6
6
  import dayjs from 'dayjs';
7
7
  import { InputWrapper } from '../Form/form.component';
8
8
  import s from '../../tc.module.css';
@@ -10,7 +10,7 @@ import { cn } from '../../utils';
10
10
  export const DatePickerComp = ({ title = 'Title', className, disable, value, showFormat = 'yyyy-MM-dd', placeholder = 'Select Date', }) => {
11
11
  const [pickedDate, setPickedDate] = useState(value && dayjs(value).toDate());
12
12
  const CustomInput = forwardRef((props, ref) => {
13
- return (_jsxs("div", { onClick: !disable && props.onClick, ref: ref, className: cn(s['border-gray-light'], s['place-items-center'], s['border'], s['rounded-md'], s['px-2'], s.flex), children: [_jsx("label", { className: cn(s['mr-3'], s['font-arimaRegular'], s['text-primaryCharcoal'], s['text-lg']), children: props.value || props.placeholder }), _jsx(DatePickerSvg, { width: 15, height: 15 })] }));
13
+ return (_jsxs("div", { onClick: !disable && props.onClick, ref: ref, className: cn(s['border-gray-light'], s['place-items-center'], s['border'], s['rounded-md'], s['px-2'], s.flex), children: [_jsx("label", { className: cn(s['mr-3'], s['font-arimaRegular'], s['text-primaryCharcoal'], s['text-lg']), children: props.value || props.placeholder }), _jsx(Icon, { nameIcon: "ImCalendar" })] }));
14
14
  });
15
15
  CustomInput.displayName = 'CustomInput';
16
16
  const handleChanges = (date) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
- import { CheckedRadio, UncheckRadio } from '../../library/assets/svg';
3
+ import { Icon } from '..';
4
4
  import { InputWrapper } from '../Form/form.component';
5
5
  import s from '../../tc.module.css';
6
6
  import { cn } from '../../utils';
@@ -16,5 +16,5 @@ export const Radio = ({ title = 'Source', data = [], className, onChange, }) =>
16
16
  });
17
17
  setList(result);
18
18
  onChange(result?.find((item) => item.checked));
19
- }, children: _jsxs("div", { className: cn(s['flex'], s['flex-row'], s['gap-1'], s['items-center']), children: [item.checked ? (_jsx(CheckedRadio, { width: width, height: width })) : (_jsx(UncheckRadio, { width: width, height: width })), _jsx("span", { className: cn(s['text-4xs']), children: item?.title })] }) }, index))) }) }));
19
+ }, children: _jsxs("div", { className: cn(s['flex'], s['flex-row'], s['gap-1'], s['items-center']), children: [item.checked ? (_jsx(Icon, { nameIcon: "ImRadioChecked" })) : (_jsx(Icon, { nameIcon: "ImRadioUnchecked" })), _jsx("span", { className: cn(s['text-4xs']), children: item?.title })] }) }, index))) }) }));
20
20
  };