react-restyle-components 0.3.77 → 0.3.80

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 (95) hide show
  1. package/lib/src/core-components/index.d.ts +0 -10
  2. package/lib/src/core-components/index.d.ts.map +1 -1
  3. package/lib/src/core-components/index.js +0 -10
  4. package/lib/src/core-components/src/components/Badge/Badge.d.ts +5 -5
  5. package/lib/src/core-components/src/components/FormField/FormField.d.ts +38 -3
  6. package/lib/src/core-components/src/components/FormField/FormField.d.ts.map +1 -1
  7. package/lib/src/core-components/src/components/FormField/FormField.js +77 -4
  8. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.d.ts +20 -0
  9. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.d.ts.map +1 -0
  10. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +37 -0
  11. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.d.ts +17 -0
  12. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.d.ts.map +1 -0
  13. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +8 -0
  14. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.d.ts +19 -0
  15. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.d.ts.map +1 -0
  16. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +114 -0
  17. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.d.ts +18 -0
  18. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.d.ts.map +1 -0
  19. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +29 -0
  20. package/lib/src/core-components/src/components/FormField/components/DropdownInput.d.ts +18 -0
  21. package/lib/src/core-components/src/components/FormField/components/DropdownInput.d.ts.map +1 -0
  22. package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +70 -0
  23. package/lib/src/core-components/src/components/FormField/components/OtpInput.d.ts +18 -0
  24. package/lib/src/core-components/src/components/FormField/components/OtpInput.d.ts.map +1 -0
  25. package/lib/src/core-components/src/components/FormField/components/OtpInput.js +81 -0
  26. package/lib/src/core-components/src/components/FormField/components/PasswordInput.d.ts +17 -0
  27. package/lib/src/core-components/src/components/FormField/components/PasswordInput.d.ts.map +1 -0
  28. package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +18 -0
  29. package/lib/src/core-components/src/components/FormField/components/PinInput.d.ts +18 -0
  30. package/lib/src/core-components/src/components/FormField/components/PinInput.d.ts.map +1 -0
  31. package/lib/src/core-components/src/components/FormField/components/PinInput.js +75 -0
  32. package/lib/src/core-components/src/components/FormField/components/RadioInput.d.ts +23 -0
  33. package/lib/src/core-components/src/components/FormField/components/RadioInput.d.ts.map +1 -0
  34. package/lib/src/core-components/src/components/FormField/components/RadioInput.js +54 -0
  35. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.d.ts +20 -0
  36. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.d.ts.map +1 -0
  37. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +94 -0
  38. package/lib/src/core-components/src/components/FormField/components/ToggleInput.d.ts +17 -0
  39. package/lib/src/core-components/src/components/FormField/components/ToggleInput.d.ts.map +1 -0
  40. package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +36 -0
  41. package/lib/src/core-components/src/components/FormField/components/index.d.ts +12 -0
  42. package/lib/src/core-components/src/components/FormField/components/index.d.ts.map +1 -0
  43. package/lib/src/core-components/src/components/FormField/components/index.js +11 -0
  44. package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.d.ts.map +1 -1
  45. package/lib/src/core-components/src/components/{Form → FormField}/toggle.css +1 -0
  46. package/lib/src/core-components/src/components/index.d.ts +1 -2
  47. package/lib/src/core-components/src/components/index.d.ts.map +1 -1
  48. package/lib/src/core-components/src/components/index.js +1 -2
  49. package/lib/src/core-components/src/core-components/CoreButton/CoreButton.d.ts +2 -2
  50. package/lib/src/core-components/src/core-components/atoms/Input/Input.d.ts.map +1 -1
  51. package/lib/src/core-components/src/core-components/atoms/Input/Input.js +4 -1
  52. package/lib/src/core-components/src/core-components/atoms/Label/Label.d.ts +2 -0
  53. package/lib/src/core-components/src/core-components/atoms/Label/Label.d.ts.map +1 -1
  54. package/lib/src/core-components/src/core-components/atoms/Label/Label.js +16 -3
  55. package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +1 -1
  56. package/lib/src/core-components/src/tc.global.css +8 -2
  57. package/lib/src/core-components/src/tc.module.css +1 -1
  58. package/lib/src/core-components/src/utils/utility.util.d.ts +1 -0
  59. package/lib/src/core-components/src/utils/utility.util.d.ts.map +1 -1
  60. package/lib/src/core-components/src/utils/utility.util.js +9 -0
  61. package/package.json +1 -1
  62. package/lib/src/core-components/src/components/Form/form.component.d.ts +0 -106
  63. package/lib/src/core-components/src/components/Form/form.component.d.ts.map +0 -1
  64. package/lib/src/core-components/src/components/Form/form.component.js +0 -88
  65. package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.d.ts +0 -13
  66. package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.d.ts.map +0 -1
  67. package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.js +0 -103
  68. package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.d.ts +0 -10
  69. package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.d.ts.map +0 -1
  70. package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.js +0 -44
  71. package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.d.ts +0 -14
  72. package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.d.ts.map +0 -1
  73. package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.js +0 -62
  74. package/lib/src/core-components/src/components/Input/InputOTP/input-otp.styles.css +0 -35
  75. package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.d.ts +0 -16
  76. package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.d.ts.map +0 -1
  77. package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.js +0 -76
  78. package/lib/src/core-components/src/components/Input/InputPin/input.styles.css +0 -35
  79. package/lib/src/core-components/src/components/check-box/checkBox.component.d.ts +0 -12
  80. package/lib/src/core-components/src/components/check-box/checkBox.component.d.ts.map +0 -1
  81. package/lib/src/core-components/src/components/check-box/checkBox.component.js +0 -20
  82. package/lib/src/core-components/src/components/date-picker/date-picker.component.d.ts +0 -12
  83. package/lib/src/core-components/src/components/date-picker/date-picker.component.d.ts.map +0 -1
  84. package/lib/src/core-components/src/components/date-picker/date-picker.component.js +0 -20
  85. package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.d.ts +0 -10
  86. package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.d.ts.map +0 -1
  87. package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.js +0 -44
  88. package/lib/src/core-components/src/components/radio/radio.component.d.ts +0 -9
  89. package/lib/src/core-components/src/components/radio/radio.component.d.ts.map +0 -1
  90. package/lib/src/core-components/src/components/radio/radio.component.js +0 -20
  91. package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.d.ts +0 -16
  92. package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.d.ts.map +0 -1
  93. package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.js +0 -91
  94. /package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.d.ts +0 -0
  95. /package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.js +0 -0
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { Label } from '../../../core-components/atoms/Label/Label';
4
+ import { Icon } from '../../Icon';
5
+ import s from '../../../tc.module.css';
6
+ import { cn } from '../../../utils';
7
+ export const DropdownInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, dropdownItems = [], placeholder, name, className, labelProps, ...props }, ref) => {
8
+ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
9
+ const [dropdownValue, setDropdownValue] = useState(value || '');
10
+ const [filteredDropdownItems, setFilteredDropdownItems] = useState(dropdownItems);
11
+ const dropdownWrapperRef = useRef(null);
12
+ useEffect(() => {
13
+ if (dropdownItems) {
14
+ setFilteredDropdownItems(dropdownItems);
15
+ }
16
+ }, [dropdownItems]);
17
+ useEffect(() => {
18
+ if (value !== undefined) {
19
+ setDropdownValue(value);
20
+ }
21
+ }, [value]);
22
+ // Outside click handler
23
+ useEffect(() => {
24
+ function handleClickOutside(event) {
25
+ if (dropdownWrapperRef.current &&
26
+ !dropdownWrapperRef.current.contains(event.target) &&
27
+ isDropdownOpen) {
28
+ setIsDropdownOpen(false);
29
+ }
30
+ }
31
+ document.addEventListener('mousedown', handleClickOutside);
32
+ return () => {
33
+ document.removeEventListener('mousedown', handleClickOutside);
34
+ };
35
+ }, [isDropdownOpen]);
36
+ const handleDropdownInputChange = (event) => {
37
+ const inputValue = event.target.value;
38
+ setDropdownValue(inputValue);
39
+ const filtered = dropdownItems.filter((item) => item.toLowerCase().includes(inputValue.toLowerCase()));
40
+ setFilteredDropdownItems(filtered);
41
+ if (onChange) {
42
+ onChange(inputValue);
43
+ }
44
+ };
45
+ const handleDropdownItemSelect = (item) => {
46
+ setDropdownValue(item);
47
+ setIsDropdownOpen(false);
48
+ if (onChange) {
49
+ onChange(item);
50
+ }
51
+ };
52
+ return (_jsxs("div", { className: cn(s['w-full'], s['relative'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps })), _jsxs("div", { className: cn(s['flex'], s['flex-row'], s['items-center']), ref: dropdownWrapperRef, children: [_jsx("input", { ref: ref, id: id, type: "text", name: name || id, placeholder: placeholder || label, value: dropdownValue, disabled: disabled, className: cn(s['pt-3'], s['pb-2'], s['w-full'], s['px-0'], s['mt-0'], s['bg-transparent'], s['border-gray-secondary'], s['border-0'], s['border-b'], s['appearance-none'], s['focus:outline-none'], s['focus:ring-0'], s['font-arimaRegular'], s['text-md'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50'], error && s['border-red-500']), onClick: () => {
53
+ if (!disabled) {
54
+ setIsDropdownOpen(!isDropdownOpen);
55
+ }
56
+ }, onChange: handleDropdownInputChange, ...props }), !isDropdownOpen && (_jsx(Icon, { nameIcon: "MdKeyboardArrowDown", propsIcon: { size: '24', color: '#000000' }, onClick: () => {
57
+ if (!disabled) {
58
+ setIsDropdownOpen(!isDropdownOpen);
59
+ }
60
+ } })), isDropdownOpen && (_jsx(Icon, { nameIcon: "MdKeyboardArrowUp", propsIcon: { size: '24', color: '#000000' }, onClick: () => {
61
+ if (!disabled) {
62
+ setIsDropdownOpen(!isDropdownOpen);
63
+ }
64
+ } }))] }), isDropdownOpen && (_jsx("div", { className: cn(s['z-10'], s['w-full'], s['absolute'], s['text-base'], s['list-none'], s['bg-white'], s['rounded'], s['divide-y'], s['divide-gray-100'], s['shadow'], s['dark:bg-gray-700']), children: _jsx("ul", { className: s['py-1'], children: filteredDropdownItems?.map((item, index) => (_jsx("li", { className: cn(s['block'], s['py-2'], s['px-4'], s['text-md'], s['hover:bg-gray-100'], s['dark:hover:bg-gray-600'], s['dark:text-gray-200'], s['font-arimaRegular'], s['cursor-pointer']), onClick: () => {
65
+ if (!disabled) {
66
+ handleDropdownItemSelect(item);
67
+ }
68
+ }, children: item }, index))) }) })), error && (_jsx("span", { className: cn(s['text-red'], s['text-4xs']), id: "error", children: error || `${label || 'Field'} is required` }))] }));
69
+ });
70
+ DropdownInput.displayName = 'DropdownInput';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export interface OtpInputProps {
3
+ id: string;
4
+ label?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ value?: Array<number | undefined>;
8
+ onChange?: (value: Array<number | undefined>) => void;
9
+ disabled?: boolean;
10
+ otpLength?: number;
11
+ pinErrorMsg?: string;
12
+ pinDefaultMsg?: string;
13
+ className?: string;
14
+ labelProps?: any;
15
+ [key: string]: any;
16
+ }
17
+ export declare const OtpInput: React.ForwardRefExoticComponent<Omit<OtpInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
18
+ //# sourceMappingURL=OtpInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OtpInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/OtpInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,QAAQ,qGA6JpB,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { Label } from '../../../core-components/atoms/Label/Label';
4
+ import s from '../../../tc.module.css';
5
+ import { cn } from '../../../utils';
6
+ export const OtpInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, otpLength = 6, pinErrorMsg, pinDefaultMsg, className, labelProps, ...props }, ref) => {
7
+ const [pinState, setPinState] = useState(value || []);
8
+ const pinInputRefs = useRef([]);
9
+ useEffect(() => {
10
+ if (value) {
11
+ setPinState(value);
12
+ }
13
+ }, [value]);
14
+ const handlePinChange = (event, index) => {
15
+ const val = event.target.value;
16
+ const pinNumber = Number(val.trim());
17
+ if (isNaN(pinNumber) || val.length === 0)
18
+ return;
19
+ if (pinNumber >= 0 && pinNumber <= 9) {
20
+ const newPin = [...pinState];
21
+ newPin[index] = pinNumber;
22
+ setPinState(newPin);
23
+ if (onChange) {
24
+ onChange(newPin);
25
+ }
26
+ if (index < otpLength - 1) {
27
+ const nextRef = pinInputRefs.current[index + 1];
28
+ if (nextRef)
29
+ nextRef.focus();
30
+ }
31
+ }
32
+ };
33
+ const handlePinKeyDown = (event, index) => {
34
+ if (event.nativeEvent.code !== 'Backspace')
35
+ return;
36
+ if (pinState[index] !== undefined) {
37
+ const newPin = [...pinState];
38
+ newPin[index] = undefined;
39
+ setPinState(newPin);
40
+ if (onChange) {
41
+ onChange(newPin);
42
+ }
43
+ if (index > 0) {
44
+ const prevRef = pinInputRefs.current[index - 1];
45
+ if (prevRef)
46
+ prevRef.focus();
47
+ }
48
+ }
49
+ else if (index > 0) {
50
+ const prevRef = pinInputRefs.current[index - 1];
51
+ if (prevRef)
52
+ prevRef.focus();
53
+ }
54
+ };
55
+ return (_jsxs("div", { className: cn(s['w-full'], s['relative'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps })), _jsx("div", { className: cn(s['flex'], s['gap-2'], s['p-2'], s['text-center']), children: Array.from({ length: otpLength }, (_, index) => (_jsx("input", { ref: (el) => {
56
+ if (el) {
57
+ pinInputRefs.current[index] = el;
58
+ }
59
+ if (index === 0 && ref) {
60
+ if (typeof ref === 'function') {
61
+ ref(el);
62
+ }
63
+ else {
64
+ ref.current = el;
65
+ }
66
+ }
67
+ }, type: "tel", disabled: disabled, className: cn(s['text-md'], s['font-extrabold'], s['bg-transparent'], s['text-center'], s['z-20'], s['border'], s['border-gray-secondary'], s['rounded-full'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50'], error && s['border-red-500']), style: { width: '30px', height: '30px' }, onKeyDown: (event) => handlePinKeyDown(event, index), onMouseUp: () => {
68
+ if (pinState.join('').length <= 0) {
69
+ const firstRef = pinInputRefs.current[0];
70
+ if (firstRef)
71
+ firstRef.focus();
72
+ }
73
+ }, onClick: () => {
74
+ if (pinState.join('').length <= 0) {
75
+ if (onChange) {
76
+ onChange([]);
77
+ }
78
+ }
79
+ }, onChange: (event) => handlePinChange(event, index), value: pinState[index] || '', ...props }, index))) }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error || pinErrorMsg })), !error && pinDefaultMsg && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-gray-600'], s['dark:text-gray-400']), children: pinDefaultMsg }))] }));
80
+ });
81
+ OtpInput.displayName = 'OtpInput';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface PasswordInputProps {
3
+ id: string;
4
+ label?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ value?: string;
8
+ onChange?: (value: string) => void;
9
+ disabled?: boolean;
10
+ placeholder?: string;
11
+ className?: string;
12
+ labelProps?: any;
13
+ [key: string]: any;
14
+ }
15
+ export declare const PasswordInput: React.ForwardRefExoticComponent<Omit<PasswordInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
16
+ export {};
17
+ //# sourceMappingURL=PasswordInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/PasswordInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAItC,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,0GAsIzB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState } from 'react';
3
+ import s from '../../../tc.module.css';
4
+ import { cn } from '../../../utils';
5
+ export const PasswordInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, placeholder, className, labelProps, ...props }, ref) => {
6
+ const [showPassword, setShowPassword] = useState(false);
7
+ const handlePasswordMouseDown = () => {
8
+ setShowPassword(true);
9
+ };
10
+ const handlePasswordMouseUp = () => {
11
+ setShowPassword(false);
12
+ };
13
+ return (_jsxs("div", { className: cn(s['w-full'], className), children: [label && (_jsxs("label", { htmlFor: id, className: cn(s['block'], s['text-sm'], s['font-medium'], s['text-gray-700'], s['dark:text-gray-300'], s['mb-1']), ...labelProps, children: [label, required && (_jsx("span", { className: cn(s['text-red-500'], s['ml-1']), children: "*" }))] })), _jsxs("div", { className: cn(s['flex'], s['items-center'], s['relative']), children: [_jsx("input", { ref: ref, id: id, type: showPassword ? 'text' : 'password', required: required, disabled: disabled, value: value, onChange: (e) => onChange?.(e.target.value), placeholder: placeholder, className: cn(s['w-full'], s['px-4'], s['py-2'], s['pr-12'], s['border'], s['rounded-lg'], s['transition-colors'], s['bg-white'], s['dark:bg-gray-800'], s['border-gray-300'], s['dark:border-gray-600'], s['text-gray-900'], s['dark:text-gray-100'], s['placeholder-gray-500'], s['dark:placeholder-gray-400'], s['focus:outline-none'], s['focus:ring-2'], s['focus:ring-primary'], s['focus:ring-offset-1'], error && s['border-red-500'], error && s['focus:ring-red-500'], className), style: {
14
+ ...props.style,
15
+ '--tw-ring-offset-color': '#ffffff',
16
+ }, ...props }), _jsx("div", { className: cn(s['flex'], s['absolute'], s['right-3'], s['z-10']), children: _jsx("svg", { className: cn(s['h-6'], s['w-6'], s['cursor-pointer']), fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 576 512", onMouseDown: handlePasswordMouseDown, onMouseUp: handlePasswordMouseUp, onMouseLeave: handlePasswordMouseUp, children: showPassword ? (_jsx("path", { fill: "currentColor", d: "M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z" })) : (_jsx("path", { fill: "currentColor", d: "M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z" })) }) })] }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
17
+ });
18
+ PasswordInput.displayName = 'PasswordInput';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export interface PinInputProps {
3
+ id: string;
4
+ label?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ value?: Array<number | undefined>;
8
+ onChange?: (value: Array<number | undefined>) => void;
9
+ disabled?: boolean;
10
+ pinLength?: number;
11
+ pinErrorMsg?: string;
12
+ pinDefaultMsg?: string;
13
+ className?: string;
14
+ labelProps?: any;
15
+ [key: string]: any;
16
+ }
17
+ export declare const PinInput: React.ForwardRefExoticComponent<Omit<PinInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
18
+ //# sourceMappingURL=PinInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/PinInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,QAAQ,qGAkLpB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { Label } from '../../../core-components/atoms/Label/Label';
4
+ import s from '../../../tc.module.css';
5
+ import { cn } from '../../../utils';
6
+ export const PinInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, pinLength = 12, pinErrorMsg, pinDefaultMsg, className, labelProps, ...props }, ref) => {
7
+ const [pinState, setPinState] = useState(value || []);
8
+ const pinInputRefs = useRef([]);
9
+ useEffect(() => {
10
+ if (value) {
11
+ setPinState(value);
12
+ }
13
+ }, [value]);
14
+ const handlePinChange = (event, index) => {
15
+ const inputValue = event.target.value;
16
+ const numericValue = parseInt(inputValue, 10);
17
+ if (!isNaN(numericValue) && numericValue >= 0 && numericValue <= 9) {
18
+ const newPinState = [...pinState];
19
+ newPinState[index] = numericValue;
20
+ setPinState(newPinState);
21
+ if (onChange) {
22
+ onChange(newPinState);
23
+ }
24
+ // Move to next input
25
+ if (index < pinLength - 1) {
26
+ const nextRef = pinInputRefs.current[index + 1];
27
+ if (nextRef) {
28
+ nextRef.focus();
29
+ }
30
+ }
31
+ }
32
+ else if (inputValue === '') {
33
+ const newPinState = [...pinState];
34
+ newPinState[index] = undefined;
35
+ setPinState(newPinState);
36
+ if (onChange) {
37
+ onChange(newPinState);
38
+ }
39
+ }
40
+ };
41
+ const handlePinKeyDown = (event, index) => {
42
+ if (event.key === 'Backspace' && !pinState[index] && index > 0) {
43
+ const prevRef = pinInputRefs.current[index - 1];
44
+ if (prevRef) {
45
+ prevRef.focus();
46
+ }
47
+ }
48
+ };
49
+ return (_jsxs("div", { className: cn(s['w-full'], s['relative'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps })), _jsx("div", { className: cn(s['flex'], s['space-x-1']), children: Array.from({ length: pinLength }, (_, index) => (_jsxs("div", { className: cn(s['flex'], s['space-x-1'], s['max-w-full'], s['items-stretch']), children: [_jsx("input", { ref: (el) => {
50
+ if (el) {
51
+ pinInputRefs.current[index] = el;
52
+ }
53
+ if (index === 0 && ref) {
54
+ if (typeof ref === 'function') {
55
+ ref(el);
56
+ }
57
+ else {
58
+ ref.current = el;
59
+ }
60
+ }
61
+ }, "data-testid": "inputElementPin", type: "tel", disabled: disabled, className: cn(s['pb-2'], s['block'], s['w-4'], s['px-0'], s['mt-0'], s['bg-transparent'], s['text-center'], s['border-0'], s['border-b'], s['z-20'], s['appearance-none'], s['rounded-none'], s['focus:outline-none'], s['focus:ring-0'], s['focus:border-gray-secondary'], s['border-gray-secondary'], s['font-arimaRegular'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50'], error && s['border-red-500']), onKeyDown: (event) => handlePinKeyDown(event, index), onMouseUp: () => {
62
+ if (pinState.join('').length <= 0) {
63
+ const firstRef = pinInputRefs.current[0];
64
+ if (firstRef)
65
+ firstRef.focus();
66
+ }
67
+ }, onClick: () => {
68
+ if (pinState.join('').length <= 0) {
69
+ if (onChange) {
70
+ onChange([]);
71
+ }
72
+ }
73
+ }, onChange: (event) => handlePinChange(event, index), value: pinState[index]?.toString() || '', ...props }), _jsx("div", { className: s['invisible'], children: (index + 1) % 4 === 0 ? 'ss' : null })] }, index))) }), error && (_jsx("span", { className: cn(s['text-sm'], s['text-red'], s['text-4xs'], s['font-arimaRegular']), id: "error", children: error || pinErrorMsg || '' })), !error && pinDefaultMsg && (_jsx("span", { className: cn(s['text-sm'], s['text-4xs'], s['font-arimaRegular']), id: "error", children: pinDefaultMsg }))] }));
74
+ });
75
+ PinInput.displayName = 'PinInput';
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export interface RadioOption {
3
+ label?: string;
4
+ value?: string;
5
+ title?: string;
6
+ checked?: boolean;
7
+ }
8
+ export interface RadioInputProps {
9
+ id: string;
10
+ label?: string;
11
+ error?: string;
12
+ required?: boolean;
13
+ value?: string | RadioOption;
14
+ onChange?: (value: string | RadioOption) => void;
15
+ disabled?: boolean;
16
+ radioOptions?: RadioOption[];
17
+ name?: string;
18
+ className?: string;
19
+ labelProps?: any;
20
+ [key: string]: any;
21
+ }
22
+ export declare const RadioInput: React.ForwardRefExoticComponent<Omit<RadioInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
23
+ //# sourceMappingURL=RadioInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/RadioInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,uGAmKtB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React, { useState, useEffect } from 'react';
3
+ import { Label } from '../../../core-components/atoms/Label/Label';
4
+ import { Icon } from '../../Icon';
5
+ import s from '../../../tc.module.css';
6
+ import { cn } from '../../../utils';
7
+ export const RadioInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, radioOptions = [], name, className, labelProps, ...props }, ref) => {
8
+ const [radioList, setRadioList] = useState(radioOptions);
9
+ useEffect(() => {
10
+ if (radioOptions) {
11
+ setRadioList(radioOptions);
12
+ }
13
+ }, [radioOptions]);
14
+ // Check if using icon-based radio (has title/checked properties)
15
+ const firstOption = radioList[0];
16
+ const isIconBased = firstOption && ('title' in firstOption || 'checked' in firstOption);
17
+ const handleRadioChange = (index) => {
18
+ if (isIconBased) {
19
+ const result = radioList.map((e, i) => {
20
+ if (i === index)
21
+ return { ...e, checked: true };
22
+ else
23
+ return { ...e, checked: false };
24
+ });
25
+ setRadioList(result);
26
+ if (onChange) {
27
+ onChange(result.find((item) => item.checked));
28
+ }
29
+ }
30
+ else {
31
+ // Native radio button behavior
32
+ const selectedOption = radioList[index];
33
+ if (onChange && selectedOption?.value) {
34
+ onChange(selectedOption.value);
35
+ }
36
+ }
37
+ };
38
+ const renderIconBasedRadio = () => (_jsx(_Fragment, { children: radioList.map((item, index) => (_jsx("div", { className: cn(s['flex'], s['items-center'], s['mb-1'], !disabled && s['cursor-pointer'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50'], className), onClick: () => {
39
+ if (!disabled) {
40
+ handleRadioChange(index);
41
+ }
42
+ }, 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))) }));
43
+ const renderNativeRadio = () => (_jsx(_Fragment, { children: radioList.map((item, key) => (_jsxs("div", { className: cn(s['flex'], s['items-center'], s['gap-2'], s['mb-2']), onClick: () => {
44
+ if (!disabled && item.value) {
45
+ handleRadioChange(key);
46
+ }
47
+ }, children: [_jsx("input", { ref: ref, type: "radio", id: `${id}-${key}`, name: name || id, value: item.value, checked: value === item.value, onChange: () => {
48
+ if (item.value) {
49
+ handleRadioChange(key);
50
+ }
51
+ }, disabled: disabled, className: cn(s['w-4'], s['h-4'], s['text-blue-600'], s['bg-gray-100'], s['border-gray-300'], s['focus:ring-blue-500'], s['dark:focus:ring-blue-600'], s['dark:ring-offset-gray-800'], s['focus:ring-2'], s['dark:bg-gray-700'], s['dark:border-gray-600']), ...props }), _jsx("label", { htmlFor: `${id}-${key}`, className: cn(s['cursor-pointer']), children: item.label })] }, key))) }));
52
+ return (_jsxs("div", { className: cn(s['w-full'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps, children: isIconBased ? renderIconBasedRadio() : renderNativeRadio() })), !label && (_jsx(_Fragment, { children: isIconBased ? renderIconBasedRadio() : renderNativeRadio() })), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
53
+ });
54
+ RadioInput.displayName = 'RadioInput';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export interface TextDropdownInputProps {
3
+ id: string;
4
+ label?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ value?: string;
8
+ onChange?: (value: string) => void;
9
+ onBlur?: (event: React.FocusEvent<HTMLInputElement> | null, value?: string) => void;
10
+ disabled?: boolean;
11
+ dropdownItems?: string[];
12
+ allowCustomInput?: boolean;
13
+ placeholder?: string;
14
+ name?: string;
15
+ className?: string;
16
+ labelProps?: any;
17
+ [key: string]: any;
18
+ }
19
+ export declare const TextDropdownInput: React.ForwardRefExoticComponent<Omit<TextDropdownInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
20
+ //# sourceMappingURL=TextDropdownInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextDropdownInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/TextDropdownInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAMzD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CACP,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI,EAChD,KAAK,CAAC,EAAE,MAAM,KACX,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,8GA+S7B,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { Label } from '../../../core-components/atoms/Label/Label';
4
+ import { Icon } from '../../Icon';
5
+ import s from '../../../tc.module.css';
6
+ import { cn } from '../../../utils';
7
+ export const TextDropdownInput = React.forwardRef(({ id, label, error, required, value, onChange, onBlur, disabled, dropdownItems = [], allowCustomInput = true, placeholder = 'Select an option', name, className, labelProps, ...props }, ref) => {
8
+ const [isTextDropdownOpen, setIsTextDropdownOpen] = useState(false);
9
+ const [textDropdownValue, setTextDropdownValue] = useState(value || '');
10
+ const [filteredTextDropdownItems, setFilteredTextDropdownItems] = useState(dropdownItems);
11
+ const [isTextEditing, setIsTextEditing] = useState(false);
12
+ const textDropdownWrapperRef = useRef(null);
13
+ useEffect(() => {
14
+ if (dropdownItems) {
15
+ setFilteredTextDropdownItems(dropdownItems);
16
+ }
17
+ }, [dropdownItems]);
18
+ useEffect(() => {
19
+ if (value !== undefined) {
20
+ setTextDropdownValue(value);
21
+ }
22
+ }, [value]);
23
+ useEffect(() => {
24
+ if (isTextEditing && textDropdownValue) {
25
+ const filtered = dropdownItems.filter((item) => item.toLowerCase().includes(textDropdownValue.toLowerCase()));
26
+ setFilteredTextDropdownItems(filtered);
27
+ }
28
+ else {
29
+ setFilteredTextDropdownItems(dropdownItems);
30
+ }
31
+ }, [textDropdownValue, dropdownItems, isTextEditing]);
32
+ // Outside click handler
33
+ useEffect(() => {
34
+ function handleClickOutside(event) {
35
+ if (textDropdownWrapperRef.current &&
36
+ !textDropdownWrapperRef.current.contains(event.target) &&
37
+ isTextDropdownOpen) {
38
+ setIsTextDropdownOpen(false);
39
+ setIsTextEditing(false);
40
+ }
41
+ }
42
+ document.addEventListener('mousedown', handleClickOutside);
43
+ return () => {
44
+ document.removeEventListener('mousedown', handleClickOutside);
45
+ };
46
+ }, [isTextDropdownOpen]);
47
+ const handleTextDropdownInputChange = (event) => {
48
+ const inputValue = event.target.value;
49
+ setTextDropdownValue(inputValue);
50
+ setIsTextEditing(true);
51
+ const filtered = dropdownItems.filter((item) => item.toLowerCase().includes(inputValue.toLowerCase()));
52
+ setFilteredTextDropdownItems(filtered);
53
+ if (onChange) {
54
+ onChange(inputValue);
55
+ }
56
+ };
57
+ const handleTextDropdownItemSelect = (item) => {
58
+ setTextDropdownValue(item);
59
+ setIsTextDropdownOpen(false);
60
+ setIsTextEditing(false);
61
+ if (onChange) {
62
+ onChange(item);
63
+ }
64
+ if (onBlur) {
65
+ onBlur(null, item);
66
+ }
67
+ };
68
+ const handleTextDropdownClick = () => {
69
+ if (!disabled) {
70
+ setIsTextDropdownOpen(!isTextDropdownOpen);
71
+ setIsTextEditing(true);
72
+ }
73
+ };
74
+ const handleTextDropdownFocus = () => {
75
+ if (!disabled) {
76
+ setIsTextEditing(true);
77
+ }
78
+ };
79
+ const handleTextDropdownBlur = (event) => {
80
+ setTimeout(() => {
81
+ setIsTextEditing(false);
82
+ }, 150);
83
+ if (onBlur) {
84
+ onBlur(event, textDropdownValue);
85
+ }
86
+ };
87
+ return (_jsxs("div", { className: cn(s['w-full'], s['relative'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps })), _jsxs("div", { className: cn(s['flex'], s['flex-row'], s['items-center'], s['leading-4'], s['p-2'], s['dark:bg-boxdark'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md'], error ? s['border-red'] : s['border-gray-300'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50']), ref: textDropdownWrapperRef, children: [_jsx("input", { ref: ref, id: id, type: "text", name: name || id, placeholder: placeholder, value: textDropdownValue, disabled: disabled, readOnly: !allowCustomInput, className: cn(s['w-full'], s['bg-transparent'], s['border-0'], s['appearance-none'], s['focus:outline-none'], s['focus:ring-0'], s['font-arimaRegular'], s['text-md'], disabled && s['cursor-not-allowed'], disabled && s['opacity-50']), onClick: handleTextDropdownClick, onChange: allowCustomInput ? handleTextDropdownInputChange : undefined, onFocus: handleTextDropdownFocus, onBlur: handleTextDropdownBlur, ...props }), !disabled && (_jsx(Icon, { nameIcon: isTextDropdownOpen ? 'MdKeyboardArrowUp' : 'MdKeyboardArrowDown', propsIcon: { size: '16', color: '#000000' }, onClick: handleTextDropdownClick }))] }), isTextDropdownOpen && !disabled && (_jsx("div", { className: cn(s['z-10'], s['w-full'], s['absolute'], s['text-base'], s['list-none'], s['bg-white'], s['rounded'], s['divide-y'], s['divide-gray-100'], s['shadow'], s['dark:bg-gray-700'], s['max-h-60'], s['overflow-y-auto']), children: _jsxs("ul", { className: s['py-1'], children: [filteredTextDropdownItems.length > 0 ? (filteredTextDropdownItems.map((item, index) => (_jsx("li", { className: cn(s['block'], s['py-2'], s['px-4'], s['text-md'], s['hover:bg-gray-100'], s['dark:hover:bg-gray-600'], s['dark:text-gray-200'], s['font-arimaRegular'], s['cursor-pointer'], textDropdownValue === item && s['bg-blue-50'], textDropdownValue === item && s['text-blue-700']), onClick: () => handleTextDropdownItemSelect(item), children: item }, index)))) : (_jsx("li", { className: cn(s['block'], s['py-2'], s['px-4'], s['text-md'], s['text-gray-500'], s['font-arimaRegular']), children: allowCustomInput
88
+ ? 'No matches found'
89
+ : 'No options available' })), allowCustomInput &&
90
+ textDropdownValue &&
91
+ !dropdownItems.includes(textDropdownValue) &&
92
+ isTextEditing && (_jsx("li", { className: cn(s['block'], s['py-2'], s['px-4'], s['text-md'], s['hover:bg-gray-100'], s['dark:hover:bg-gray-600'], s['dark:text-gray-200'], s['font-arimaRegular'], s['cursor-pointer'], s['border-t'], s['border-gray-200'], s['bg-green-50'], s['text-green-700']), onClick: () => handleTextDropdownItemSelect(textDropdownValue), children: _jsxs("span", { className: cn(s['flex'], s['ml-2'], s['items-center'], s['gap-1']), children: [_jsx(Icon, { nameIcon: "MdAdd", propsIcon: { size: '16', color: '#059669' } }), "\"", textDropdownValue, "\""] }) }))] }) })), error && (_jsx("span", { className: cn(s['text-red'], s['text-4xs']), id: "error", children: error || `${label || 'Field'} is required` }))] }));
93
+ });
94
+ TextDropdownInput.displayName = 'TextDropdownInput';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import '../toggle.css';
3
+ export interface ToggleInputProps {
4
+ id: string;
5
+ label?: string;
6
+ error?: string;
7
+ required?: boolean;
8
+ value?: boolean;
9
+ onChange?: (value: boolean) => void;
10
+ disabled?: boolean;
11
+ isToggleLabel?: boolean;
12
+ className?: string;
13
+ labelProps?: any;
14
+ [key: string]: any;
15
+ }
16
+ export declare const ToggleInput: React.ForwardRefExoticComponent<Omit<ToggleInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
17
+ //# sourceMappingURL=ToggleInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/ToggleInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,eAAe,CAAC;AAEvB,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,wGAiGvB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect } from 'react';
3
+ import classNames from 'classnames';
4
+ import { Label } from '../../../core-components/atoms/Label/Label';
5
+ import s from '../../../tc.module.css';
6
+ import { cn } from '../../../utils';
7
+ import '../toggle.css';
8
+ export const ToggleInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, isToggleLabel = true, className, labelProps, ...props }, ref) => {
9
+ const [toggleValue, setToggleValue] = useState(value ?? false);
10
+ useEffect(() => {
11
+ if (value !== undefined) {
12
+ setToggleValue(value);
13
+ }
14
+ }, [value]);
15
+ const handleToggleClick = () => {
16
+ if (disabled)
17
+ return;
18
+ const newValue = !toggleValue;
19
+ setToggleValue(newValue);
20
+ if (onChange) {
21
+ onChange(newValue);
22
+ }
23
+ };
24
+ const toggleClasses = classNames('wrg-toggle', {
25
+ 'wrg-toggle--checked': toggleValue,
26
+ 'wrg-toggle--disabled': disabled,
27
+ }, className);
28
+ return (_jsxs("div", { className: cn(s['w-full'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps })), _jsxs("div", { onClick: handleToggleClick, className: toggleClasses, children: [_jsx("div", { className: cn('wrg-toggle-container', {
29
+ [s['bg-green-700']]: toggleValue,
30
+ [s['bg-black']]: !toggleValue,
31
+ }), children: isToggleLabel && (_jsxs(_Fragment, { children: [_jsx("div", { className: cn('wrg-toggle-check'), children: _jsx("span", { className: cn(s['text-white'], s['ml-1']), children: "Yes" }) }), _jsx("div", { className: cn('wrg-toggle-uncheck'), children: _jsx("span", { className: cn(s['dark:text-black']), children: "No" }) })] })) }), _jsx("div", { className: cn('wrg-toggle-circle', s['dark:bg-black'], {
32
+ 'ml-1': toggleValue,
33
+ 'mr-1': !toggleValue,
34
+ }) }), _jsx("input", { ref: ref, type: "checkbox", "aria-label": "Toggle Button", className: cn('wrg-toggle-input'), checked: toggleValue, readOnly: true, ...props })] }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
35
+ });
36
+ ToggleInput.displayName = 'ToggleInput';
@@ -0,0 +1,12 @@
1
+ export { PasswordInput } from './PasswordInput';
2
+ export { ToggleInput } from './ToggleInput';
3
+ export { RadioInput, type RadioOption } from './RadioInput';
4
+ export { CheckboxInput } from './CheckboxInput';
5
+ export { CheckboxGroupInput, type CheckboxOption } from './CheckboxGroupInput';
6
+ export { DatePickerInput } from './DatePickerInput';
7
+ export { DropdownInput } from './DropdownInput';
8
+ export { TextDropdownInput } from './TextDropdownInput';
9
+ export { PinInput } from './PinInput';
10
+ export { OtpInput } from './OtpInput';
11
+ export { CssMultilineInput } from './CssMultilineInput';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAE,KAAK,WAAW,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,kBAAkB,EAAE,KAAK,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { PasswordInput } from './PasswordInput';
2
+ export { ToggleInput } from './ToggleInput';
3
+ export { RadioInput } from './RadioInput';
4
+ export { CheckboxInput } from './CheckboxInput';
5
+ export { CheckboxGroupInput } from './CheckboxGroupInput';
6
+ export { DatePickerInput } from './DatePickerInput';
7
+ export { DropdownInput } from './DropdownInput';
8
+ export { TextDropdownInput } from './TextDropdownInput';
9
+ export { PinInput } from './PinInput';
10
+ export { OtpInput } from './OtpInput';
11
+ export { CssMultilineInput } from './CssMultilineInput';