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.
- package/lib/src/core-components/index.d.ts +0 -10
- package/lib/src/core-components/index.d.ts.map +1 -1
- package/lib/src/core-components/index.js +0 -10
- package/lib/src/core-components/src/components/Badge/Badge.d.ts +5 -5
- package/lib/src/core-components/src/components/FormField/FormField.d.ts +38 -3
- package/lib/src/core-components/src/components/FormField/FormField.d.ts.map +1 -1
- package/lib/src/core-components/src/components/FormField/FormField.js +77 -4
- package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.d.ts +20 -0
- package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +37 -0
- package/lib/src/core-components/src/components/FormField/components/CheckboxInput.d.ts +17 -0
- package/lib/src/core-components/src/components/FormField/components/CheckboxInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +8 -0
- package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.d.ts +19 -0
- package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +114 -0
- package/lib/src/core-components/src/components/FormField/components/DatePickerInput.d.ts +18 -0
- package/lib/src/core-components/src/components/FormField/components/DatePickerInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +29 -0
- package/lib/src/core-components/src/components/FormField/components/DropdownInput.d.ts +18 -0
- package/lib/src/core-components/src/components/FormField/components/DropdownInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +70 -0
- package/lib/src/core-components/src/components/FormField/components/OtpInput.d.ts +18 -0
- package/lib/src/core-components/src/components/FormField/components/OtpInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/OtpInput.js +81 -0
- package/lib/src/core-components/src/components/FormField/components/PasswordInput.d.ts +17 -0
- package/lib/src/core-components/src/components/FormField/components/PasswordInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +18 -0
- package/lib/src/core-components/src/components/FormField/components/PinInput.d.ts +18 -0
- package/lib/src/core-components/src/components/FormField/components/PinInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/PinInput.js +75 -0
- package/lib/src/core-components/src/components/FormField/components/RadioInput.d.ts +23 -0
- package/lib/src/core-components/src/components/FormField/components/RadioInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/RadioInput.js +54 -0
- package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.d.ts +20 -0
- package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +94 -0
- package/lib/src/core-components/src/components/FormField/components/ToggleInput.d.ts +17 -0
- package/lib/src/core-components/src/components/FormField/components/ToggleInput.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +36 -0
- package/lib/src/core-components/src/components/FormField/components/index.d.ts +12 -0
- package/lib/src/core-components/src/components/FormField/components/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/FormField/components/index.js +11 -0
- package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.d.ts.map +1 -1
- package/lib/src/core-components/src/components/{Form → FormField}/toggle.css +1 -0
- package/lib/src/core-components/src/components/index.d.ts +1 -2
- package/lib/src/core-components/src/components/index.d.ts.map +1 -1
- package/lib/src/core-components/src/components/index.js +1 -2
- package/lib/src/core-components/src/core-components/CoreButton/CoreButton.d.ts +2 -2
- package/lib/src/core-components/src/core-components/atoms/Input/Input.d.ts.map +1 -1
- package/lib/src/core-components/src/core-components/atoms/Input/Input.js +4 -1
- package/lib/src/core-components/src/core-components/atoms/Label/Label.d.ts +2 -0
- package/lib/src/core-components/src/core-components/atoms/Label/Label.d.ts.map +1 -1
- package/lib/src/core-components/src/core-components/atoms/Label/Label.js +16 -3
- package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +1 -1
- package/lib/src/core-components/src/tc.global.css +8 -2
- package/lib/src/core-components/src/tc.module.css +1 -1
- package/lib/src/core-components/src/utils/utility.util.d.ts +1 -0
- package/lib/src/core-components/src/utils/utility.util.d.ts.map +1 -1
- package/lib/src/core-components/src/utils/utility.util.js +9 -0
- package/package.json +1 -1
- package/lib/src/core-components/src/components/Form/form.component.d.ts +0 -106
- package/lib/src/core-components/src/components/Form/form.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Form/form.component.js +0 -88
- package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.d.ts +0 -13
- package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Input/CSSMultilineInput/css-multiline-input.component.js +0 -103
- package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.d.ts +0 -10
- package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Input/InputDropdown/input-dropdown.component.js +0 -44
- package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.d.ts +0 -14
- package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Input/InputOTP/input-otp.component.js +0 -62
- package/lib/src/core-components/src/components/Input/InputOTP/input-otp.styles.css +0 -35
- package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.d.ts +0 -16
- package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Input/InputPin/input-pin.component.js +0 -76
- package/lib/src/core-components/src/components/Input/InputPin/input.styles.css +0 -35
- package/lib/src/core-components/src/components/check-box/checkBox.component.d.ts +0 -12
- package/lib/src/core-components/src/components/check-box/checkBox.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/check-box/checkBox.component.js +0 -20
- package/lib/src/core-components/src/components/date-picker/date-picker.component.d.ts +0 -12
- package/lib/src/core-components/src/components/date-picker/date-picker.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/date-picker/date-picker.component.js +0 -20
- package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.d.ts +0 -10
- package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/input-dropdown/input-dropdown.component.js +0 -44
- package/lib/src/core-components/src/components/radio/radio.component.d.ts +0 -9
- package/lib/src/core-components/src/components/radio/radio.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/radio/radio.component.js +0 -20
- package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.d.ts +0 -16
- package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/text-input-dropdown/text-input-dropdown.component.js +0 -91
- /package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.d.ts +0 -0
- /package/lib/src/core-components/src/components/{Input/CSSMultilineInput → FormField}/css-properties.js +0 -0
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export * from './src/components/';
|
|
2
|
-
import * as Form from './src/components/Form/form.component';
|
|
3
2
|
export * from './src/components/button/button.component';
|
|
4
3
|
export * from './src/components/button/buttonGroup/buttonGroup.component';
|
|
5
|
-
export * from './src/components/check-box/checkBox.component';
|
|
6
|
-
export * from './src/components/date-picker/date-picker.component';
|
|
7
|
-
export * from './src/components/Input/InputOTP/input-otp.component';
|
|
8
|
-
export * from './src/components/Input/InputPin/input-pin.component';
|
|
9
|
-
export * from './src/components/input-dropdown/input-dropdown.component';
|
|
10
4
|
export * from './src/components/Loader/loader.component';
|
|
11
|
-
export * from './src/components/radio/radio.component';
|
|
12
5
|
export * from './src/components/stepper/stepper.component';
|
|
13
6
|
export * from './src/components/timer/timer.component';
|
|
14
7
|
export * from './src/components/tooltip/tooltip.component';
|
|
@@ -19,8 +12,6 @@ export * from './src/components/pdf/pdf-table.components';
|
|
|
19
12
|
export * from './src/components/pdf/pdf-typography.components';
|
|
20
13
|
export * from './src/components/pdf/pdf-wrapped-view.components';
|
|
21
14
|
export * from './src/components/Accordion/collapsible/collapsible.component';
|
|
22
|
-
export * from './src/components/text-input-dropdown/text-input-dropdown.component';
|
|
23
|
-
export * from './src/components/Input/CSSMultilineInput/css-multiline-input.component';
|
|
24
15
|
export * from './src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component';
|
|
25
16
|
export * from './src/components/AutoComplete/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component';
|
|
26
17
|
export * from './src/components/Selection/multi-select/multi-select.component';
|
|
@@ -37,5 +28,4 @@ export * from './src/components/AutoComplete/auto-complete-filter-multi-select-m
|
|
|
37
28
|
export * from './src/components/Selection/single-select/single-select.component';
|
|
38
29
|
export * from './src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component';
|
|
39
30
|
export * from './src/components/Accordion/AccordionSection';
|
|
40
|
-
export { Form };
|
|
41
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core-components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core-components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0CAA0C,CAAC;AACzD,cAAc,2DAA2D,CAAC;AAC1E,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,8DAA8D,CAAC;AAE7E,cAAc,mKAAmK,CAAC;AAClL,cAAc,+JAA+J,CAAC;AAC9K,cAAc,gEAAgE,CAAC;AAC/E,cAAc,sFAAsF,CAAC;AACrG,cAAc,mDAAmD,CAAC;AAClE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,yDAAyD,CAAC;AACxE,cAAc,uFAAuF,CAAC;AACtG,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yEAAyE,CAAC;AACxF,cAAc,+GAA+G,CAAC;AAC9H,cAAc,uJAAuJ,CAAC;AACtK,cAAc,2KAA2K,CAAC;AAC1L,cAAc,kEAAkE,CAAC;AACjF,cAAc,qLAAqL,CAAC;AAGpM,cAAc,6CAA6C,CAAC"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export * from './src/components/';
|
|
2
|
-
import * as Form from './src/components/Form/form.component';
|
|
3
2
|
export * from './src/components/button/button.component';
|
|
4
3
|
export * from './src/components/button/buttonGroup/buttonGroup.component';
|
|
5
|
-
export * from './src/components/check-box/checkBox.component';
|
|
6
|
-
export * from './src/components/date-picker/date-picker.component';
|
|
7
|
-
export * from './src/components/Input/InputOTP/input-otp.component';
|
|
8
|
-
export * from './src/components/Input/InputPin/input-pin.component';
|
|
9
|
-
export * from './src/components/input-dropdown/input-dropdown.component';
|
|
10
4
|
export * from './src/components/Loader/loader.component';
|
|
11
|
-
export * from './src/components/radio/radio.component';
|
|
12
5
|
export * from './src/components/stepper/stepper.component';
|
|
13
6
|
export * from './src/components/timer/timer.component';
|
|
14
7
|
export * from './src/components/tooltip/tooltip.component';
|
|
@@ -19,8 +12,6 @@ export * from './src/components/pdf/pdf-table.components';
|
|
|
19
12
|
export * from './src/components/pdf/pdf-typography.components';
|
|
20
13
|
export * from './src/components/pdf/pdf-wrapped-view.components';
|
|
21
14
|
export * from './src/components/Accordion/collapsible/collapsible.component';
|
|
22
|
-
export * from './src/components/text-input-dropdown/text-input-dropdown.component';
|
|
23
|
-
export * from './src/components/Input/CSSMultilineInput/css-multiline-input.component';
|
|
24
15
|
export * from './src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component';
|
|
25
16
|
export * from './src/components/AutoComplete/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component';
|
|
26
17
|
export * from './src/components/Selection/multi-select/multi-select.component';
|
|
@@ -38,4 +29,3 @@ export * from './src/components/Selection/single-select/single-select.component'
|
|
|
38
29
|
export * from './src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component';
|
|
39
30
|
// New comp. added
|
|
40
31
|
export * from './src/components/Accordion/AccordionSection';
|
|
41
|
-
export { Form };
|
|
@@ -7,6 +7,8 @@ export declare const Badge: React.NamedExoticComponent<Omit<BadgeProps & React.R
|
|
|
7
7
|
} & {
|
|
8
8
|
Inline: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
9
9
|
children?: React.ReactNode;
|
|
10
|
+
content?: string | undefined;
|
|
11
|
+
className?: string | undefined;
|
|
10
12
|
slot?: string | undefined;
|
|
11
13
|
style?: React.CSSProperties | undefined;
|
|
12
14
|
title?: string | undefined;
|
|
@@ -17,7 +19,6 @@ export declare const Badge: React.NamedExoticComponent<Omit<BadgeProps & React.R
|
|
|
17
19
|
accessKey?: string | undefined;
|
|
18
20
|
autoCapitalize?: "none" | (string & {}) | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
19
21
|
autoFocus?: boolean | undefined;
|
|
20
|
-
className?: string | undefined;
|
|
21
22
|
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
22
23
|
contextMenu?: string | undefined;
|
|
23
24
|
dir?: string | undefined;
|
|
@@ -33,7 +34,6 @@ export declare const Badge: React.NamedExoticComponent<Omit<BadgeProps & React.R
|
|
|
33
34
|
radioGroup?: string | undefined;
|
|
34
35
|
role?: React.AriaRole | undefined;
|
|
35
36
|
about?: string | undefined;
|
|
36
|
-
content?: string | undefined;
|
|
37
37
|
datatype?: string | undefined;
|
|
38
38
|
inlist?: any;
|
|
39
39
|
prefix?: string | undefined;
|
|
@@ -54,11 +54,11 @@ export declare const Badge: React.NamedExoticComponent<Omit<BadgeProps & React.R
|
|
|
54
54
|
results?: number | undefined;
|
|
55
55
|
security?: string | undefined;
|
|
56
56
|
unselectable?: "off" | "on" | undefined;
|
|
57
|
-
inputMode?: "
|
|
57
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
58
58
|
is?: string | undefined;
|
|
59
59
|
"aria-activedescendant"?: string | undefined;
|
|
60
60
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
61
|
-
"aria-autocomplete"?: "
|
|
61
|
+
"aria-autocomplete"?: "inline" | "both" | "none" | "list" | undefined;
|
|
62
62
|
"aria-braillelabel"?: string | undefined;
|
|
63
63
|
"aria-brailleroledescription"?: string | undefined;
|
|
64
64
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -73,7 +73,7 @@ export declare const Badge: React.NamedExoticComponent<Omit<BadgeProps & React.R
|
|
|
73
73
|
"aria-description"?: string | undefined;
|
|
74
74
|
"aria-details"?: string | undefined;
|
|
75
75
|
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
76
|
-
"aria-dropeffect"?: "
|
|
76
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
77
77
|
"aria-errormessage"?: string | undefined;
|
|
78
78
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
79
79
|
"aria-flowto"?: string | undefined;
|
|
@@ -2,7 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { InputProps } from '../../core-components/atoms/Input/Input';
|
|
3
3
|
import { TextareaProps } from '../../core-components/atoms/Textarea/Textarea';
|
|
4
4
|
import { LabelProps } from '../../core-components/atoms/Label/Label';
|
|
5
|
+
import { type RadioOption, type CheckboxOption } from './components';
|
|
5
6
|
export type { InputProps, TextareaProps, LabelProps };
|
|
7
|
+
export type { RadioOption, CheckboxOption } from './components';
|
|
8
|
+
export { PasswordInput, ToggleInput, RadioInput, CheckboxInput, CheckboxGroupInput, DatePickerInput, DropdownInput, TextDropdownInput, PinInput, OtpInput, CssMultilineInput, } from './components';
|
|
6
9
|
interface BaseFormFieldProps {
|
|
7
10
|
/** Label text displayed above the input */
|
|
8
11
|
label?: string;
|
|
@@ -14,13 +17,45 @@ interface BaseFormFieldProps {
|
|
|
14
17
|
id?: string;
|
|
15
18
|
/** Whether the field is required */
|
|
16
19
|
required?: boolean;
|
|
17
|
-
/** Input type - use 'textarea'
|
|
18
|
-
type?: React.InputHTMLAttributes<HTMLInputElement>['type'] | 'textarea';
|
|
20
|
+
/** Input type - use 'textarea', 'toggle', 'radio', 'checkbox', 'checkbox-group', 'date-picker', 'input-dropdown', 'text-input-dropdown', 'input-pin', 'input-otp', or 'css-multiline' for special types */
|
|
21
|
+
type?: React.InputHTMLAttributes<HTMLInputElement>['type'] | 'textarea' | 'toggle' | 'radio' | 'checkbox' | 'checkbox-group' | 'date-picker' | 'input-dropdown' | 'text-input-dropdown' | 'input-pin' | 'input-otp' | 'css-multiline';
|
|
22
|
+
/** Show password toggle button (only for type="password") */
|
|
23
|
+
showPasswordToggle?: boolean;
|
|
24
|
+
/** Radio options (only for type="radio") */
|
|
25
|
+
radioOptions?: RadioOption[];
|
|
26
|
+
/** Checkbox label (only for type="checkbox") */
|
|
27
|
+
checkboxLabel?: string;
|
|
28
|
+
/** Checkbox group options (only for type="checkbox-group") */
|
|
29
|
+
checkboxOptions?: CheckboxOption[];
|
|
30
|
+
/** Toggle label visibility (only for type="toggle") */
|
|
31
|
+
isToggleLabel?: boolean;
|
|
32
|
+
/** Date format (only for type="date-picker") */
|
|
33
|
+
dateFormat?: string;
|
|
34
|
+
/** Dropdown items (only for type="input-dropdown" or "text-input-dropdown") */
|
|
35
|
+
dropdownItems?: string[];
|
|
36
|
+
/** Allow custom input values (only for type="text-input-dropdown", default: true) */
|
|
37
|
+
allowCustomInput?: boolean;
|
|
38
|
+
/** PIN length (only for type="input-pin", default: 12) */
|
|
39
|
+
pinLength?: number;
|
|
40
|
+
/** OTP length (only for type="input-otp", default: 6) */
|
|
41
|
+
otpLength?: number;
|
|
42
|
+
/** PIN/OTP value array (only for type="input-pin" or "input-otp") */
|
|
43
|
+
pinValue?: Array<number | undefined>;
|
|
44
|
+
/** Error message for PIN/OTP (only for type="input-pin" or "input-otp") */
|
|
45
|
+
pinErrorMsg?: string;
|
|
46
|
+
/** Default message for PIN/OTP (only for type="input-pin" or "input-otp") */
|
|
47
|
+
pinDefaultMsg?: string;
|
|
48
|
+
/** CSS properties data (only for type="css-multiline") */
|
|
49
|
+
cssProperties?: Array<[string, string[]]>;
|
|
50
|
+
/** On reset callback (only for type="css-multiline") */
|
|
51
|
+
onReset?: (value: string) => void;
|
|
52
|
+
/** On more info callback (only for type="css-multiline") */
|
|
53
|
+
onMoreInfo?: () => void;
|
|
19
54
|
}
|
|
20
55
|
type HTMLFieldAttributes = React.InputHTMLAttributes<HTMLInputElement> | React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
21
56
|
type SafeHTMLAttributes = Pick<HTMLFieldAttributes, 'name' | 'placeholder' | 'value' | 'defaultValue' | 'disabled' | 'readOnly' | 'autoFocus' | 'autoComplete' | 'className' | 'style' | 'maxLength' | 'minLength' | 'tabIndex' | 'aria-label' | 'aria-describedby' | 'aria-invalid' | 'aria-required'>;
|
|
22
57
|
type FieldEventHandlers = {
|
|
23
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
58
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | string | boolean) => void;
|
|
24
59
|
onFocus?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
25
60
|
onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
26
61
|
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAEL,aAAa,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAEL,aAAa,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAYL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAC,UAAU,EAAE,aAAa,EAAE,UAAU,EAAC,CAAC;AACpD,YAAY,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAG9D,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,UAAU,kBAAkB;IAC1B,2CAA2C;IAC3C,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|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Input } from '../../core-components/atoms/Input/Input';
|
|
4
4
|
import { Textarea, } from '../../core-components/atoms/Textarea/Textarea';
|
|
5
|
-
import {
|
|
6
|
-
export
|
|
5
|
+
import { PasswordInput, ToggleInput, RadioInput, CheckboxInput, CheckboxGroupInput, DatePickerInput, DropdownInput, TextDropdownInput, PinInput, OtpInput, CssMultilineInput, } from './components';
|
|
6
|
+
// Re-export all FormField components for direct use
|
|
7
|
+
export { PasswordInput, ToggleInput, RadioInput, CheckboxInput, CheckboxGroupInput, DatePickerInput, DropdownInput, TextDropdownInput, PinInput, OtpInput, CssMultilineInput, } from './components';
|
|
8
|
+
export const FormField = React.forwardRef(({ label, error, id, labelProps, required, type = 'text', showPasswordToggle, radioOptions, checkboxLabel, checkboxOptions, isToggleLabel = true, dateFormat = 'yyyy-MM-dd', dropdownItems = [], allowCustomInput = true, pinLength = 12, otpLength = 6, pinValue = [], pinErrorMsg, pinDefaultMsg, cssProperties, onReset, onMoreInfo, value, onChange, disabled, ...props }, ref) => {
|
|
7
9
|
const fieldId = id || `field-${Math.random().toString(36).substr(2, 9)}`;
|
|
8
10
|
const isTextarea = type === 'textarea';
|
|
9
|
-
|
|
11
|
+
const isToggle = type === 'toggle';
|
|
12
|
+
const isRadio = type === 'radio';
|
|
13
|
+
const isCheckbox = type === 'checkbox';
|
|
14
|
+
const isCheckboxGroup = type === 'checkbox-group';
|
|
15
|
+
const isDatePicker = type === 'date-picker';
|
|
16
|
+
const isInputDropdown = type === 'input-dropdown';
|
|
17
|
+
const isTextInputDropdown = type === 'text-input-dropdown';
|
|
18
|
+
const isInputPin = type === 'input-pin';
|
|
19
|
+
const isInputOtp = type === 'input-otp';
|
|
20
|
+
const isCssMultiline = type === 'css-multiline';
|
|
21
|
+
const isPassword = type === 'password';
|
|
22
|
+
// Handle checkbox change
|
|
23
|
+
const handleCheckboxChange = (e) => {
|
|
24
|
+
if (onChange) {
|
|
25
|
+
onChange(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// Render toggle switch
|
|
29
|
+
if (isToggle) {
|
|
30
|
+
return (_jsx(ToggleInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, isToggleLabel: isToggleLabel, labelProps: labelProps, className: props.className, ...props }));
|
|
31
|
+
}
|
|
32
|
+
// Render radio buttons
|
|
33
|
+
if (isRadio && radioOptions) {
|
|
34
|
+
return (_jsx(RadioInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, radioOptions: radioOptions, name: props.name, className: props.className, labelProps: labelProps, ...props }));
|
|
35
|
+
}
|
|
36
|
+
// Render checkbox
|
|
37
|
+
if (isCheckbox) {
|
|
38
|
+
return (_jsx(CheckboxInput, { ref: ref, id: fieldId, label: label, checkboxLabel: checkboxLabel, error: error, required: required, value: value, onChange: handleCheckboxChange, disabled: disabled, name: props.name, labelProps: labelProps, ...props }));
|
|
39
|
+
}
|
|
40
|
+
// Render checkbox group
|
|
41
|
+
if (isCheckboxGroup && checkboxOptions) {
|
|
42
|
+
return (_jsx(CheckboxGroupInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, checkboxOptions: checkboxOptions, className: props.className, labelProps: labelProps, ...props }));
|
|
43
|
+
}
|
|
44
|
+
// Render date picker
|
|
45
|
+
if (isDatePicker) {
|
|
46
|
+
return (_jsx(DatePickerInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, dateFormat: dateFormat, placeholder: props.placeholder, className: props.className, labelProps: labelProps, ...props }));
|
|
47
|
+
}
|
|
48
|
+
// Render input dropdown
|
|
49
|
+
if (isInputDropdown) {
|
|
50
|
+
return (_jsx(DropdownInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, dropdownItems: dropdownItems, placeholder: props.placeholder, name: props.name, className: props.className, labelProps: labelProps, ...props }));
|
|
51
|
+
}
|
|
52
|
+
// Render text input dropdown
|
|
53
|
+
if (isTextInputDropdown) {
|
|
54
|
+
return (_jsx(TextDropdownInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, onBlur: props.onBlur, disabled: disabled, dropdownItems: dropdownItems, allowCustomInput: allowCustomInput, placeholder: props.placeholder, name: props.name, className: props.className, labelProps: labelProps, ...props }));
|
|
55
|
+
}
|
|
56
|
+
// Render input PIN
|
|
57
|
+
if (isInputPin) {
|
|
58
|
+
return (_jsx(PinInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: pinValue, onChange: onChange, disabled: disabled, pinLength: pinLength, pinErrorMsg: pinErrorMsg, pinDefaultMsg: pinDefaultMsg, className: props.className, labelProps: labelProps, ...props }));
|
|
59
|
+
}
|
|
60
|
+
// Render input OTP
|
|
61
|
+
if (isInputOtp) {
|
|
62
|
+
return (_jsx(OtpInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: pinValue, onChange: onChange, disabled: disabled, otpLength: otpLength, pinErrorMsg: pinErrorMsg, pinDefaultMsg: pinDefaultMsg, className: props.className, labelProps: labelProps, ...props }));
|
|
63
|
+
}
|
|
64
|
+
// Render CSS Multiline
|
|
65
|
+
if (isCssMultiline) {
|
|
66
|
+
return (_jsx(CssMultilineInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, cssProperties: cssProperties, onReset: onReset, onMoreInfo: onMoreInfo, placeholder: props.placeholder, className: props.className, labelProps: labelProps, ...props }));
|
|
67
|
+
}
|
|
68
|
+
// Render textarea - use Textarea atom component
|
|
69
|
+
if (isTextarea) {
|
|
70
|
+
return (_jsx(Textarea, { ref: ref, id: fieldId, label: label, error: error, required: required, ...labelProps, ...props }));
|
|
71
|
+
}
|
|
72
|
+
// Render standard input - use Input atom component
|
|
73
|
+
// For password without toggle, use Input atom
|
|
74
|
+
if (isPassword && !showPasswordToggle) {
|
|
75
|
+
return (_jsx(Input, { ref: ref, id: fieldId, type: type, label: label, error: error, required: required, ...labelProps, ...props }));
|
|
76
|
+
}
|
|
77
|
+
// For password with toggle, use PasswordInput component
|
|
78
|
+
if (isPassword && showPasswordToggle) {
|
|
79
|
+
return (_jsx(PasswordInput, { ref: ref, id: fieldId, label: label, error: error, required: required, value: value, onChange: onChange, disabled: disabled, labelProps: labelProps, ...props }));
|
|
80
|
+
}
|
|
81
|
+
// Render standard input - use Input atom component
|
|
82
|
+
return (_jsx(Input, { ref: ref, id: fieldId, type: type, label: label, error: error, required: required, ...labelProps, ...props }));
|
|
10
83
|
});
|
|
11
84
|
FormField.displayName = 'FormField';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CheckboxOption {
|
|
3
|
+
title: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CheckboxGroupInputProps {
|
|
7
|
+
id: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
error?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
value?: CheckboxOption[];
|
|
12
|
+
onChange?: (value: CheckboxOption[]) => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
checkboxOptions?: CheckboxOption[];
|
|
15
|
+
className?: string;
|
|
16
|
+
labelProps?: any;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export declare const CheckboxGroupInput: React.ForwardRefExoticComponent<Omit<CheckboxGroupInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
20
|
+
//# sourceMappingURL=CheckboxGroupInput.d.ts.map
|
package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGroupInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/CheckboxGroupInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,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,cAAc,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,+GAqG9B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 CheckboxGroupInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, checkboxOptions = [], className, labelProps, ...props }, ref) => {
|
|
8
|
+
const [checkboxList, setCheckboxList] = useState(checkboxOptions);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (checkboxOptions) {
|
|
11
|
+
setCheckboxList(checkboxOptions);
|
|
12
|
+
}
|
|
13
|
+
}, [checkboxOptions]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (value) {
|
|
16
|
+
setCheckboxList(value);
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
const handleCheckboxGroupChange = (index) => {
|
|
20
|
+
const result = checkboxList.map((e, i) => {
|
|
21
|
+
if (i === index)
|
|
22
|
+
return { ...e, checked: !e.checked };
|
|
23
|
+
else
|
|
24
|
+
return { ...e };
|
|
25
|
+
});
|
|
26
|
+
setCheckboxList(result);
|
|
27
|
+
if (onChange) {
|
|
28
|
+
onChange(result.filter((item) => item.checked));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs("div", { className: cn(s['w-full'], className), children: [_jsx(Label, { label: label, required: required, ...labelProps, children: checkboxList?.map((item, index) => (_jsxs("div", { className: cn(s['flex'], s['flex-row'], s['items-center'], s['mb-2'], className), onClick: () => {
|
|
32
|
+
if (!disabled) {
|
|
33
|
+
handleCheckboxGroupChange(index);
|
|
34
|
+
}
|
|
35
|
+
}, 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'], disabled && s['cursor-not-allowed'], !disabled && s['cursor-pointer']), children: item?.title })] }, index))) }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
|
|
36
|
+
});
|
|
37
|
+
CheckboxGroupInput.displayName = 'CheckboxGroupInput';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CheckboxInputProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
checkboxLabel?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
value?: boolean;
|
|
9
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
labelProps?: any;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export declare const CheckboxInput: React.ForwardRefExoticComponent<Omit<CheckboxInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
|
+
//# sourceMappingURL=CheckboxInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/CheckboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,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,aAAa,0GAqEzB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import s from '../../../tc.module.css';
|
|
4
|
+
import { cn } from '../../../utils';
|
|
5
|
+
export const CheckboxInput = React.forwardRef(({ id, label, checkboxLabel, error, required, value, onChange, disabled, name, className, labelProps, ...props }, ref) => {
|
|
6
|
+
return (_jsxs("div", { className: cn(s['w-full'], className), children: [_jsxs("div", { className: cn(s['flex'], s['items-center'], s['gap-2']), children: [_jsx("input", { ref: ref, type: "checkbox", id: id, name: name, checked: value, onChange: onChange, 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'], className), ...props }), (checkboxLabel || label) && (_jsx("label", { htmlFor: id, className: cn(s['cursor-pointer']), children: checkboxLabel || label }))] }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
|
|
7
|
+
});
|
|
8
|
+
CheckboxInput.displayName = 'CheckboxInput';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CssMultilineInputProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
cssProperties?: Array<[string, string[]]>;
|
|
11
|
+
onReset?: (value: string) => void;
|
|
12
|
+
onMoreInfo?: () => void;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
labelProps?: any;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export declare const CssMultilineInput: React.ForwardRefExoticComponent<Omit<CssMultilineInputProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
19
|
+
//# sourceMappingURL=CssMultilineInput.d.ts.map
|
package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CssMultilineInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/CssMultilineInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAkBzD,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,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,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,iBAAiB,iHA+N7B,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { Textarea } from '../../../core-components/atoms/Textarea/Textarea';
|
|
4
|
+
import { Icon } from '../../Icon';
|
|
5
|
+
import s from '../../../tc.module.css';
|
|
6
|
+
import { cn } from '../../../utils';
|
|
7
|
+
import { properties as defaultCssProperties } from '../css-properties';
|
|
8
|
+
// Helper function to map CSS properties to array format
|
|
9
|
+
const mapToArray = (arr) => {
|
|
10
|
+
const res = [];
|
|
11
|
+
arr.forEach(function (obj, index) {
|
|
12
|
+
const key = Object.keys(obj)[0];
|
|
13
|
+
const value = key;
|
|
14
|
+
res.push([value, obj[key]]);
|
|
15
|
+
});
|
|
16
|
+
return res;
|
|
17
|
+
};
|
|
18
|
+
export const CssMultilineInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, cssProperties, onReset, onMoreInfo, placeholder = "fontSize: 12,backgroundColor:'#000000'", className, labelProps, ...props }, ref) => {
|
|
19
|
+
const [isCssListOpen, setIsCssListOpen] = useState(false);
|
|
20
|
+
const [cssPropertiesList, setCssPropertiesList] = useState(cssProperties || mapToArray(defaultCssProperties));
|
|
21
|
+
const cssValueRef = useRef(value || '');
|
|
22
|
+
const cssWrapperRef = useRef(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (cssProperties) {
|
|
25
|
+
setCssPropertiesList(cssProperties);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
setCssPropertiesList(mapToArray(defaultCssProperties));
|
|
29
|
+
}
|
|
30
|
+
}, [cssProperties]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (value !== undefined) {
|
|
33
|
+
cssValueRef.current = value;
|
|
34
|
+
}
|
|
35
|
+
}, [value]);
|
|
36
|
+
// Outside click handler
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
function handleClickOutside(event) {
|
|
39
|
+
if (cssWrapperRef.current &&
|
|
40
|
+
!cssWrapperRef.current.contains(event.target) &&
|
|
41
|
+
isCssListOpen) {
|
|
42
|
+
setIsCssListOpen(false);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
46
|
+
return () => {
|
|
47
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
48
|
+
};
|
|
49
|
+
}, [isCssListOpen]);
|
|
50
|
+
const handleCssFilter = (css) => {
|
|
51
|
+
const props = cssProperties || mapToArray(defaultCssProperties);
|
|
52
|
+
if (css.length === 0) {
|
|
53
|
+
setCssPropertiesList(props);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const matchString = css.split(/,\s*/);
|
|
57
|
+
const lastPart = matchString[matchString.length - 1];
|
|
58
|
+
const key = lastPart.split(':')[0]?.split("'")[0]?.trim();
|
|
59
|
+
const filtered = props.filter((item) => item[0]?.startsWith(key || ''));
|
|
60
|
+
setCssPropertiesList(filtered);
|
|
61
|
+
};
|
|
62
|
+
const handleCssChange = (css) => {
|
|
63
|
+
cssValueRef.current = css;
|
|
64
|
+
handleCssFilter(css);
|
|
65
|
+
if (onChange) {
|
|
66
|
+
onChange(css);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const handleReset = () => {
|
|
70
|
+
const styles = cssValueRef.current.split(',').filter(Boolean);
|
|
71
|
+
if (styles.length > 0) {
|
|
72
|
+
styles.pop();
|
|
73
|
+
cssValueRef.current = styles.join(',') + (styles.length ? ',' : '');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
cssValueRef.current = '';
|
|
77
|
+
}
|
|
78
|
+
if (onReset) {
|
|
79
|
+
onReset(cssValueRef.current);
|
|
80
|
+
}
|
|
81
|
+
if (onChange) {
|
|
82
|
+
onChange(cssValueRef.current);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs("div", { className: cn(s['flex'], s['flex-col'], s['w-full'], s['relative'], className), ref: cssWrapperRef, children: [_jsxs("div", { className: cn(s['flex'], s['absolute'], s['gap-2'], s['right-2'], s['z-10']), children: [onReset && (_jsx(Icon, { nameIcon: "MdLockReset", propsIcon: { color: '#000000', size: 24 }, onClick: handleReset })), onMoreInfo && (_jsx(Icon, { nameIcon: "MdInfoOutline", propsIcon: { color: '#000000', size: 24 }, onClick: onMoreInfo }))] }), _jsx(Textarea, { ref: ref, id: id, label: label, error: error, required: required, placeholder: placeholder, value: cssValueRef.current, onChange: (e) => {
|
|
86
|
+
const css = e.target.value;
|
|
87
|
+
handleCssChange(css);
|
|
88
|
+
setIsCssListOpen(true);
|
|
89
|
+
}, onKeyUp: () => setIsCssListOpen(true), disabled: disabled, ...labelProps, ...props }), isCssListOpen && cssPropertiesList.length > 0 && (_jsx("div", { children: _jsx("ul", { className: cn(s['flex'], s['flex-col'], s['bg-black'], s['text-white'], s['overflow-y-scroll'], s['w-full']), style: { maxHeight: 'calc(100vh - 20vh)' }, children: cssPropertiesList?.map((item, index) => (_jsxs("li", { className: cn(s['flex'], s['gap-4'], s['p-2']), children: [_jsx("span", { className: cn(s['underline']), children: item[0] }), item[1]?.map((prop, propIndex) => (_jsxs("li", { className: cn(s['flex'], s['bg-slate-800'], s['rounded-md'], s['items-center'], s['cursor-pointer']), onClick: () => {
|
|
90
|
+
let existsString = cssValueRef.current?.split(',');
|
|
91
|
+
if (cssValueRef.current.includes(',')) {
|
|
92
|
+
existsString = existsString.map((item) => {
|
|
93
|
+
if (item?.includes(':'))
|
|
94
|
+
return item;
|
|
95
|
+
});
|
|
96
|
+
if (prop != 'number')
|
|
97
|
+
existsString.push(`${item[0]}:'${prop}',`);
|
|
98
|
+
else
|
|
99
|
+
existsString.push(`${item[0]}:1,`);
|
|
100
|
+
cssValueRef.current = existsString
|
|
101
|
+
.join(',')
|
|
102
|
+
.replaceAll(',,', ',');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
if (prop != 'number')
|
|
106
|
+
cssValueRef.current = `${item[0]}:'${prop}',`;
|
|
107
|
+
else {
|
|
108
|
+
cssValueRef.current = `${item[0]}:1,`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
handleCssFilter(existsString.join(''));
|
|
112
|
+
}, children: [' ', prop, ' '] }, propIndex)))] }, index))) }) })), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
|
|
113
|
+
});
|
|
114
|
+
CssMultilineInput.displayName = 'CssMultilineInput';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
3
|
+
export interface DatePickerInputProps {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
value?: string | Date;
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
dateFormat?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
labelProps?: any;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export declare const DatePickerInput: React.ForwardRefExoticComponent<Omit<DatePickerInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
//# sourceMappingURL=DatePickerInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/DatePickerInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,4CAA4C,CAAC;AAOpD,MAAM,WAAW,oBAAoB;IACnC,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,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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;AA0CD,eAAO,MAAM,eAAe,4GAqF3B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useEffect, forwardRef } from 'react';
|
|
3
|
+
import DatePicker from 'react-datepicker';
|
|
4
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { Label } from '../../../core-components/atoms/Label/Label';
|
|
7
|
+
import { Icon } from '../../Icon';
|
|
8
|
+
import s from '../../../tc.module.css';
|
|
9
|
+
import { cn } from '../../../utils';
|
|
10
|
+
const DatePickerCustomInput = forwardRef((customInputProps, customInputRef) => {
|
|
11
|
+
return (_jsxs("div", { onClick: !customInputProps.disabled && customInputProps.onClick, ref: customInputRef, className: cn(s['border-gray-300'], s['place-items-center'], s['border'], s['rounded-md'], s['px-2'], s['py-2'], s['flex'], s['items-center'], s['w-full'], s['cursor-pointer'], customInputProps.disabled && s['cursor-not-allowed'], customInputProps.disabled && s['opacity-50']), children: [_jsx("label", { className: cn(s['mr-3'], s['font-arimaRegular'], s['text-gray-900'], s['dark:text-gray-100'], s['text-base'], s['flex-1']), children: customInputProps.value || customInputProps.placeholder }), _jsx(Icon, { nameIcon: "ImCalendar" })] }));
|
|
12
|
+
});
|
|
13
|
+
DatePickerCustomInput.displayName = 'DatePickerCustomInput';
|
|
14
|
+
export const DatePickerInput = React.forwardRef(({ id, label, error, required, value, onChange, disabled, dateFormat = 'yyyy-MM-dd', placeholder = 'Select Date', className, labelProps, ...props }, ref) => {
|
|
15
|
+
const [pickedDate, setPickedDate] = useState(value && typeof value === 'string' ? dayjs(value).toDate() : null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (value) {
|
|
18
|
+
setPickedDate(typeof value === 'string' ? dayjs(value).toDate() : value);
|
|
19
|
+
}
|
|
20
|
+
}, [value]);
|
|
21
|
+
const handleDateChange = (date) => {
|
|
22
|
+
setPickedDate(date);
|
|
23
|
+
if (onChange && date) {
|
|
24
|
+
onChange(dayjs(date).format(dateFormat));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs("div", { className: cn(s['w-full'], className), children: [label && (_jsx(Label, { id: id, required: required, label: label, ...labelProps, children: _jsx("div", { className: cn(s['flex'], s['z-50']), children: _jsx(DatePicker, { selected: pickedDate || undefined, dateFormat: dateFormat, placeholderText: placeholder, onChange: handleDateChange, customInput: _jsx(DatePickerCustomInput, { disabled: disabled }), disabled: disabled, ...props }) }) })), !label && (_jsx("div", { className: cn(s['flex'], s['z-50'], className), children: _jsx(DatePicker, { selected: pickedDate || undefined, dateFormat: dateFormat, placeholderText: placeholder, onChange: handleDateChange, customInput: _jsx(DatePickerCustomInput, { disabled: disabled }), disabled: disabled, ...props }) })), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
|
|
28
|
+
});
|
|
29
|
+
DatePickerInput.displayName = 'DatePickerInput';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DropdownInputProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
dropdownItems?: string[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
labelProps?: any;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export declare const DropdownInput: React.ForwardRefExoticComponent<Omit<DropdownInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
//# sourceMappingURL=DropdownInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/components/FormField/components/DropdownInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAMzD,MAAM,WAAW,kBAAkB;IACjC,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,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,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,aAAa,0GAqMzB,CAAC"}
|