zenput 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +271 -0
- package/dist/cjs/index.js +1126 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/AutoComplete/AutoComplete.d.ts +3 -0
- package/dist/cjs/types/components/AutoComplete/AutoComplete.types.d.ts +27 -0
- package/dist/cjs/types/components/AutoComplete/index.d.ts +2 -0
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/cjs/types/components/Checkbox/Checkbox.types.d.ts +6 -0
- package/dist/cjs/types/components/Checkbox/index.d.ts +2 -0
- package/dist/cjs/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -0
- package/dist/cjs/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +20 -0
- package/dist/cjs/types/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/cjs/types/components/ColorInput/ColorInput.d.ts +3 -0
- package/dist/cjs/types/components/ColorInput/ColorInput.types.d.ts +6 -0
- package/dist/cjs/types/components/ColorInput/index.d.ts +2 -0
- package/dist/cjs/types/components/DataTable/DataTable.d.ts +5 -0
- package/dist/cjs/types/components/DataTable/DataTable.types.d.ts +31 -0
- package/dist/cjs/types/components/DataTable/index.d.ts +2 -0
- package/dist/cjs/types/components/DateInput/DateInput.d.ts +3 -0
- package/dist/cjs/types/components/DateInput/DateInput.types.d.ts +8 -0
- package/dist/cjs/types/components/DateInput/index.d.ts +2 -0
- package/dist/cjs/types/components/FileInput/FileInput.d.ts +3 -0
- package/dist/cjs/types/components/FileInput/FileInput.types.d.ts +10 -0
- package/dist/cjs/types/components/FileInput/index.d.ts +2 -0
- package/dist/cjs/types/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/cjs/types/components/NumberInput/NumberInput.types.d.ts +18 -0
- package/dist/cjs/types/components/NumberInput/index.d.ts +2 -0
- package/dist/cjs/types/components/OTPInput/OTPInput.d.ts +3 -0
- package/dist/cjs/types/components/OTPInput/OTPInput.types.d.ts +20 -0
- package/dist/cjs/types/components/OTPInput/index.d.ts +2 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.types.d.ts +10 -0
- package/dist/cjs/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/cjs/types/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/cjs/types/components/PhoneInput/PhoneInput.types.d.ts +20 -0
- package/dist/cjs/types/components/PhoneInput/index.d.ts +2 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.types.d.ts +22 -0
- package/dist/cjs/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/cjs/types/components/RangeInput/RangeInput.d.ts +3 -0
- package/dist/cjs/types/components/RangeInput/RangeInput.types.d.ts +14 -0
- package/dist/cjs/types/components/RangeInput/index.d.ts +2 -0
- package/dist/cjs/types/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/cjs/types/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/cjs/types/components/SearchInput/index.d.ts +2 -0
- package/dist/cjs/types/components/SelectInput/SelectInput.d.ts +3 -0
- package/dist/cjs/types/components/SelectInput/SelectInput.types.d.ts +13 -0
- package/dist/cjs/types/components/SelectInput/index.d.ts +2 -0
- package/dist/cjs/types/components/TextArea/TextArea.d.ts +3 -0
- package/dist/cjs/types/components/TextArea/TextArea.types.d.ts +8 -0
- package/dist/cjs/types/components/TextArea/index.d.ts +2 -0
- package/dist/cjs/types/components/TextInput/TextInput.d.ts +3 -0
- package/dist/cjs/types/components/TextInput/TextInput.types.d.ts +4 -0
- package/dist/cjs/types/components/TextInput/index.d.ts +2 -0
- package/dist/cjs/types/components/TimeInput/TimeInput.d.ts +3 -0
- package/dist/cjs/types/components/TimeInput/TimeInput.types.d.ts +8 -0
- package/dist/cjs/types/components/TimeInput/index.d.ts +2 -0
- package/dist/cjs/types/components/Toggle/Toggle.d.ts +3 -0
- package/dist/cjs/types/components/Toggle/Toggle.types.d.ts +6 -0
- package/dist/cjs/types/components/Toggle/index.d.ts +2 -0
- package/dist/cjs/types/components/index.d.ts +19 -0
- package/dist/cjs/types/context/ThemeProvider.d.ts +27 -0
- package/dist/cjs/types/context/index.d.ts +1 -0
- package/dist/cjs/types/hooks/index.d.ts +2 -0
- package/dist/cjs/types/hooks/useControllable.d.ts +7 -0
- package/dist/cjs/types/hooks/useFormField.d.ts +25 -0
- package/dist/cjs/types/index.d.ts +4 -0
- package/dist/cjs/types/types/common.d.ts +52 -0
- package/dist/cjs/types/types/index.d.ts +1 -0
- package/dist/cjs/types/utils/classNames.d.ts +3 -0
- package/dist/cjs/types/utils/constants.d.ts +9 -0
- package/dist/cjs/types/utils/index.d.ts +3 -0
- package/dist/cjs/types/utils/validation.d.ts +23 -0
- package/dist/esm/index.js +1102 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/AutoComplete/AutoComplete.d.ts +3 -0
- package/dist/esm/types/components/AutoComplete/AutoComplete.types.d.ts +27 -0
- package/dist/esm/types/components/AutoComplete/index.d.ts +2 -0
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/esm/types/components/Checkbox/Checkbox.types.d.ts +6 -0
- package/dist/esm/types/components/Checkbox/index.d.ts +2 -0
- package/dist/esm/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -0
- package/dist/esm/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +20 -0
- package/dist/esm/types/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/esm/types/components/ColorInput/ColorInput.d.ts +3 -0
- package/dist/esm/types/components/ColorInput/ColorInput.types.d.ts +6 -0
- package/dist/esm/types/components/ColorInput/index.d.ts +2 -0
- package/dist/esm/types/components/DataTable/DataTable.d.ts +5 -0
- package/dist/esm/types/components/DataTable/DataTable.types.d.ts +31 -0
- package/dist/esm/types/components/DataTable/index.d.ts +2 -0
- package/dist/esm/types/components/DateInput/DateInput.d.ts +3 -0
- package/dist/esm/types/components/DateInput/DateInput.types.d.ts +8 -0
- package/dist/esm/types/components/DateInput/index.d.ts +2 -0
- package/dist/esm/types/components/FileInput/FileInput.d.ts +3 -0
- package/dist/esm/types/components/FileInput/FileInput.types.d.ts +10 -0
- package/dist/esm/types/components/FileInput/index.d.ts +2 -0
- package/dist/esm/types/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/esm/types/components/NumberInput/NumberInput.types.d.ts +18 -0
- package/dist/esm/types/components/NumberInput/index.d.ts +2 -0
- package/dist/esm/types/components/OTPInput/OTPInput.d.ts +3 -0
- package/dist/esm/types/components/OTPInput/OTPInput.types.d.ts +20 -0
- package/dist/esm/types/components/OTPInput/index.d.ts +2 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.types.d.ts +10 -0
- package/dist/esm/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/esm/types/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/esm/types/components/PhoneInput/PhoneInput.types.d.ts +20 -0
- package/dist/esm/types/components/PhoneInput/index.d.ts +2 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.types.d.ts +22 -0
- package/dist/esm/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/esm/types/components/RangeInput/RangeInput.d.ts +3 -0
- package/dist/esm/types/components/RangeInput/RangeInput.types.d.ts +14 -0
- package/dist/esm/types/components/RangeInput/index.d.ts +2 -0
- package/dist/esm/types/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/esm/types/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/esm/types/components/SearchInput/index.d.ts +2 -0
- package/dist/esm/types/components/SelectInput/SelectInput.d.ts +3 -0
- package/dist/esm/types/components/SelectInput/SelectInput.types.d.ts +13 -0
- package/dist/esm/types/components/SelectInput/index.d.ts +2 -0
- package/dist/esm/types/components/TextArea/TextArea.d.ts +3 -0
- package/dist/esm/types/components/TextArea/TextArea.types.d.ts +8 -0
- package/dist/esm/types/components/TextArea/index.d.ts +2 -0
- package/dist/esm/types/components/TextInput/TextInput.d.ts +3 -0
- package/dist/esm/types/components/TextInput/TextInput.types.d.ts +4 -0
- package/dist/esm/types/components/TextInput/index.d.ts +2 -0
- package/dist/esm/types/components/TimeInput/TimeInput.d.ts +3 -0
- package/dist/esm/types/components/TimeInput/TimeInput.types.d.ts +8 -0
- package/dist/esm/types/components/TimeInput/index.d.ts +2 -0
- package/dist/esm/types/components/Toggle/Toggle.d.ts +3 -0
- package/dist/esm/types/components/Toggle/Toggle.types.d.ts +6 -0
- package/dist/esm/types/components/Toggle/index.d.ts +2 -0
- package/dist/esm/types/components/index.d.ts +19 -0
- package/dist/esm/types/context/ThemeProvider.d.ts +27 -0
- package/dist/esm/types/context/index.d.ts +1 -0
- package/dist/esm/types/hooks/index.d.ts +2 -0
- package/dist/esm/types/hooks/useControllable.d.ts +7 -0
- package/dist/esm/types/hooks/useFormField.d.ts +25 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/esm/types/types/common.d.ts +52 -0
- package/dist/esm/types/types/index.d.ts +1 -0
- package/dist/esm/types/utils/classNames.d.ts +3 -0
- package/dist/esm/types/utils/constants.d.ts +9 -0
- package/dist/esm/types/utils/index.d.ts +3 -0
- package/dist/esm/types/utils/validation.d.ts +23 -0
- package/dist/index.d.ts +401 -0
- package/package.json +69 -0
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React, { useId, useState, useCallback, forwardRef, useRef, useEffect, useMemo, createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
function classNames(...args) {
|
|
5
|
+
const classes = [];
|
|
6
|
+
for (const arg of args) {
|
|
7
|
+
if (!arg)
|
|
8
|
+
continue;
|
|
9
|
+
if (typeof arg === 'string') {
|
|
10
|
+
classes.push(arg);
|
|
11
|
+
}
|
|
12
|
+
else if (typeof arg === 'object') {
|
|
13
|
+
for (const [key, value] of Object.entries(arg)) {
|
|
14
|
+
if (value)
|
|
15
|
+
classes.push(key);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return classes.join(' ');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets the appropriate message based on validation state
|
|
24
|
+
* @param validationState - Current validation state
|
|
25
|
+
* @param errorMessage - Message to show in error state
|
|
26
|
+
* @param successMessage - Message to show in success state
|
|
27
|
+
* @param warningMessage - Message to show in warning state
|
|
28
|
+
* @param helperText - Default helper text
|
|
29
|
+
* @returns The active message to display
|
|
30
|
+
*/
|
|
31
|
+
function getValidationMessage(validationState = 'default', errorMessage, successMessage, warningMessage, helperText) {
|
|
32
|
+
if (validationState === 'error')
|
|
33
|
+
return errorMessage;
|
|
34
|
+
if (validationState === 'success')
|
|
35
|
+
return successMessage;
|
|
36
|
+
if (validationState === 'warning')
|
|
37
|
+
return warningMessage;
|
|
38
|
+
return helperText;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the CSS class name for validation message styling
|
|
42
|
+
* @param validationState - Current validation state
|
|
43
|
+
* @param styles - CSS modules styles object containing message class names
|
|
44
|
+
* @returns The appropriate CSS class name
|
|
45
|
+
*/
|
|
46
|
+
function getValidationMessageClass(validationState = 'default', styles) {
|
|
47
|
+
if (validationState === 'error')
|
|
48
|
+
return styles.errorText;
|
|
49
|
+
if (validationState === 'success')
|
|
50
|
+
return styles.successText;
|
|
51
|
+
if (validationState === 'warning')
|
|
52
|
+
return styles.warningText;
|
|
53
|
+
return styles.helperText;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Common constants used across the library
|
|
58
|
+
*/
|
|
59
|
+
/** Delay before closing dropdown after blur to allow click events to fire (in milliseconds) */
|
|
60
|
+
const DROPDOWN_BLUR_DELAY_MS = 150;
|
|
61
|
+
|
|
62
|
+
function useFormField({ id, helperText, errorMessage, validationState, required, disabled, }) {
|
|
63
|
+
const generatedId = useId();
|
|
64
|
+
const inputId = id !== null && id !== void 0 ? id : `input-${generatedId}`;
|
|
65
|
+
const helperId = `${inputId}-helper`;
|
|
66
|
+
const hasHelperContent = Boolean(helperText || errorMessage);
|
|
67
|
+
return {
|
|
68
|
+
inputId,
|
|
69
|
+
helperId,
|
|
70
|
+
labelProps: { htmlFor: inputId },
|
|
71
|
+
inputAriaProps: {
|
|
72
|
+
...(hasHelperContent ? { 'aria-describedby': helperId } : {}),
|
|
73
|
+
...(validationState === 'error' ? { 'aria-invalid': true } : {}),
|
|
74
|
+
...(required ? { 'aria-required': true } : {}),
|
|
75
|
+
...(disabled ? { 'aria-disabled': true } : {}),
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function useControllable({ value, defaultValue, onChange, }) {
|
|
81
|
+
const isControlled = value !== undefined;
|
|
82
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
83
|
+
const currentValue = isControlled ? value : internalValue;
|
|
84
|
+
const handleChange = useCallback((newValue) => {
|
|
85
|
+
if (!isControlled) {
|
|
86
|
+
setInternalValue(newValue);
|
|
87
|
+
}
|
|
88
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
89
|
+
}, [isControlled, onChange]);
|
|
90
|
+
return [currentValue, handleChange];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function styleInject(css, ref) {
|
|
94
|
+
if ( ref === void 0 ) ref = {};
|
|
95
|
+
var insertAt = ref.insertAt;
|
|
96
|
+
|
|
97
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
98
|
+
|
|
99
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
100
|
+
var style = document.createElement('style');
|
|
101
|
+
style.type = 'text/css';
|
|
102
|
+
|
|
103
|
+
if (insertAt === 'top') {
|
|
104
|
+
if (head.firstChild) {
|
|
105
|
+
head.insertBefore(style, head.firstChild);
|
|
106
|
+
} else {
|
|
107
|
+
head.appendChild(style);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
head.appendChild(style);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (style.styleSheet) {
|
|
114
|
+
style.styleSheet.cssText = css;
|
|
115
|
+
} else {
|
|
116
|
+
style.appendChild(document.createTextNode(css));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var css_248z$i = ".TextInput-module_wrapper__MwqRi {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.TextInput-module_fullWidth__AMPyY {\n width: 100%;\n}\n\n.TextInput-module_label__JY3GX {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.TextInput-module_required__7j2Rq::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.TextInput-module_inputWrapper__mGu9t {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.TextInput-module_input__gzKqV {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;\n outline: none;\n box-sizing: border-box;\n}\n\n.TextInput-module_input__gzKqV::placeholder {\n color: var(--input-placeholder-color);\n}\n\n/* Sizes */\n.TextInput-module_sm__Jpp-B .TextInput-module_input__gzKqV {\n padding: 6px 10px;\n font-size: 0.75rem;\n height: 32px;\n}\n\n.TextInput-module_md__YrGPN .TextInput-module_input__gzKqV {\n padding: 8px 12px;\n font-size: 0.875rem;\n height: 40px;\n}\n\n.TextInput-module_lg__NX0s3 .TextInput-module_input__gzKqV {\n padding: 10px 16px;\n font-size: 1rem;\n height: 48px;\n}\n\n/* Variants */\n.TextInput-module_outlined__m-eGw .TextInput-module_input__gzKqV {\n border: 1px solid var(--input-border-color);\n}\n\n.TextInput-module_outlined__m-eGw .TextInput-module_input__gzKqV:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.TextInput-module_outlined__m-eGw .TextInput-module_input__gzKqV:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.TextInput-module_filled__YmoWE .TextInput-module_input__gzKqV {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.TextInput-module_filled__YmoWE .TextInput-module_input__gzKqV:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.TextInput-module_filled__YmoWE .TextInput-module_input__gzKqV:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.TextInput-module_underlined__JWk-- .TextInput-module_input__gzKqV {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n padding-right: 0;\n}\n\n.TextInput-module_underlined__JWk-- .TextInput-module_input__gzKqV:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.TextInput-module_underlined__JWk-- .TextInput-module_input__gzKqV:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n/* Validation states */\n.TextInput-module_error__IzapV .TextInput-module_input__gzKqV {\n border-color: var(--input-error-color) !important;\n}\n\n.TextInput-module_error__IzapV .TextInput-module_input__gzKqV:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.TextInput-module_success__YeilQ .TextInput-module_input__gzKqV {\n border-color: var(--input-success-color) !important;\n}\n\n.TextInput-module_success__YeilQ .TextInput-module_input__gzKqV:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.TextInput-module_warning__1384Y .TextInput-module_input__gzKqV {\n border-color: var(--input-warning-color) !important;\n}\n\n.TextInput-module_warning__1384Y .TextInput-module_input__gzKqV:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n/* Disabled */\n.TextInput-module_input__gzKqV:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n/* Prefix/Suffix */\n.TextInput-module_hasPrefixIcon__Q6XXk .TextInput-module_input__gzKqV {\n padding-left: 36px;\n}\n\n.TextInput-module_hasSuffixIcon__kwORB .TextInput-module_input__gzKqV {\n padding-right: 36px;\n}\n\n.TextInput-module_prefixIcon__xPlid,\n.TextInput-module_suffixIcon__ZgZRE {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--input-placeholder-color);\n pointer-events: none;\n}\n\n.TextInput-module_prefixIcon__xPlid {\n left: 10px;\n}\n\n.TextInput-module_suffixIcon__ZgZRE {\n right: 10px;\n}\n\n.TextInput-module_helperText__OVezy {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.TextInput-module_errorText__WcPXZ {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n\n.TextInput-module_successText__OXyzP {\n font-size: 0.75rem;\n color: var(--input-success-color);\n}\n\n.TextInput-module_warningText__Q6KnJ {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n}\n";
|
|
121
|
+
var styles$i = {"wrapper":"TextInput-module_wrapper__MwqRi","fullWidth":"TextInput-module_fullWidth__AMPyY","label":"TextInput-module_label__JY3GX","required":"TextInput-module_required__7j2Rq","inputWrapper":"TextInput-module_inputWrapper__mGu9t","input":"TextInput-module_input__gzKqV","sm":"TextInput-module_sm__Jpp-B","md":"TextInput-module_md__YrGPN","lg":"TextInput-module_lg__NX0s3","outlined":"TextInput-module_outlined__m-eGw","filled":"TextInput-module_filled__YmoWE","underlined":"TextInput-module_underlined__JWk--","error":"TextInput-module_error__IzapV","success":"TextInput-module_success__YeilQ","warning":"TextInput-module_warning__1384Y","hasPrefixIcon":"TextInput-module_hasPrefixIcon__Q6XXk","hasSuffixIcon":"TextInput-module_hasSuffixIcon__kwORB","prefixIcon":"TextInput-module_prefixIcon__xPlid","suffixIcon":"TextInput-module_suffixIcon__ZgZRE","helperText":"TextInput-module_helperText__OVezy","errorText":"TextInput-module_errorText__WcPXZ","successText":"TextInput-module_successText__OXyzP","warningText":"TextInput-module_warningText__Q6KnJ"};
|
|
122
|
+
styleInject(css_248z$i);
|
|
123
|
+
|
|
124
|
+
const TextInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon, suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, ...rest }, ref) => {
|
|
125
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
126
|
+
id,
|
|
127
|
+
helperText,
|
|
128
|
+
errorMessage,
|
|
129
|
+
validationState,
|
|
130
|
+
required,
|
|
131
|
+
disabled,
|
|
132
|
+
});
|
|
133
|
+
const activeMessage = getValidationMessage(validationState, errorMessage, successMessage, warningMessage, helperText);
|
|
134
|
+
const messageClass = getValidationMessageClass(validationState, styles$i);
|
|
135
|
+
return (jsxs("div", { className: classNames(styles$i.wrapper, styles$i[size], styles$i[variant], validationState !== 'default' ? styles$i[validationState] : undefined, fullWidth ? styles$i.fullWidth : undefined, prefixIcon ? styles$i.hasPrefixIcon : undefined, suffixIcon ? styles$i.hasSuffixIcon : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$i.label, required ? styles$i.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$i.inputWrapper, children: [prefixIcon && jsx("span", { className: styles$i.prefixIcon, children: prefixIcon }), jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, disabled: disabled, readOnly: readOnly, required: required, className: classNames(styles$i.input, inputClassName, className), style: inputStyle }), suffixIcon && jsx("span", { className: styles$i.suffixIcon, children: suffixIcon })] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
136
|
+
});
|
|
137
|
+
TextInput.displayName = 'TextInput';
|
|
138
|
+
|
|
139
|
+
var css_248z$h = ".TextArea-module_wrapper__O0sWP {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.TextArea-module_fullWidth__l88p- {\n width: 100%;\n}\n\n.TextArea-module_label__2TV89 {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.TextArea-module_required__c0fwb::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.TextArea-module_inputWrapper__1s0yh {\n position: relative;\n display: flex;\n align-items: flex-start;\n}\n\n.TextArea-module_input__8l36v {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n resize: vertical;\n min-height: 80px;\n}\n\n.TextArea-module_autoResize__z0lFS {\n resize: none;\n overflow: hidden;\n}\n\n.TextArea-module_input__8l36v::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.TextArea-module_sm__ZMvWk .TextArea-module_input__8l36v {\n padding: 6px 10px;\n font-size: 0.75rem;\n}\n\n.TextArea-module_md__3VeXV .TextArea-module_input__8l36v {\n padding: 8px 12px;\n font-size: 0.875rem;\n}\n\n.TextArea-module_lg__BzTNh .TextArea-module_input__8l36v {\n padding: 10px 16px;\n font-size: 1rem;\n}\n\n.TextArea-module_outlined__kPBWN .TextArea-module_input__8l36v {\n border: 1px solid var(--input-border-color);\n}\n\n.TextArea-module_outlined__kPBWN .TextArea-module_input__8l36v:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.TextArea-module_outlined__kPBWN .TextArea-module_input__8l36v:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.TextArea-module_filled__dMfK8 .TextArea-module_input__8l36v {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.TextArea-module_filled__dMfK8 .TextArea-module_input__8l36v:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.TextArea-module_filled__dMfK8 .TextArea-module_input__8l36v:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.TextArea-module_underlined__ToCv5 .TextArea-module_input__8l36v {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n padding-right: 0;\n resize: none;\n}\n\n.TextArea-module_underlined__ToCv5 .TextArea-module_input__8l36v:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.TextArea-module_underlined__ToCv5 .TextArea-module_input__8l36v:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n.TextArea-module_error__Jvxk5 .TextArea-module_input__8l36v {\n border-color: var(--input-error-color) !important;\n}\n\n.TextArea-module_error__Jvxk5 .TextArea-module_input__8l36v:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.TextArea-module_success__VhgM4 .TextArea-module_input__8l36v {\n border-color: var(--input-success-color) !important;\n}\n\n.TextArea-module_success__VhgM4 .TextArea-module_input__8l36v:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.TextArea-module_warning__5iMT- .TextArea-module_input__8l36v {\n border-color: var(--input-warning-color) !important;\n}\n\n.TextArea-module_warning__5iMT- .TextArea-module_input__8l36v:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n.TextArea-module_input__8l36v:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n resize: none;\n}\n\n.TextArea-module_footer__Plp7P {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n}\n\n.TextArea-module_helperText__0ecSv {\n font-size: 0.75rem;\n color: #6b7280;\n flex: 1;\n}\n\n.TextArea-module_errorText__-WKsN {\n font-size: 0.75rem;\n color: var(--input-error-color);\n flex: 1;\n}\n\n.TextArea-module_successText__vqWFw {\n font-size: 0.75rem;\n color: var(--input-success-color);\n flex: 1;\n}\n\n.TextArea-module_warningText__45qdi {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n flex: 1;\n}\n\n.TextArea-module_charCount__oakcx {\n font-size: 0.75rem;\n color: #9ca3af;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.TextArea-module_charCountExceeded__QZkpi {\n color: var(--input-error-color);\n}\n";
|
|
140
|
+
var styles$h = {"wrapper":"TextArea-module_wrapper__O0sWP","fullWidth":"TextArea-module_fullWidth__l88p-","label":"TextArea-module_label__2TV89","required":"TextArea-module_required__c0fwb","inputWrapper":"TextArea-module_inputWrapper__1s0yh","input":"TextArea-module_input__8l36v","autoResize":"TextArea-module_autoResize__z0lFS","sm":"TextArea-module_sm__ZMvWk","md":"TextArea-module_md__3VeXV","lg":"TextArea-module_lg__BzTNh","outlined":"TextArea-module_outlined__kPBWN","filled":"TextArea-module_filled__dMfK8","underlined":"TextArea-module_underlined__ToCv5","error":"TextArea-module_error__Jvxk5","success":"TextArea-module_success__VhgM4","warning":"TextArea-module_warning__5iMT-","footer":"TextArea-module_footer__Plp7P","helperText":"TextArea-module_helperText__0ecSv","errorText":"TextArea-module_errorText__-WKsN","successText":"TextArea-module_successText__vqWFw","warningText":"TextArea-module_warningText__45qdi","charCount":"TextArea-module_charCount__oakcx","charCountExceeded":"TextArea-module_charCountExceeded__QZkpi"};
|
|
141
|
+
styleInject(css_248z$h);
|
|
142
|
+
|
|
143
|
+
const TextArea = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, autoResize, showCharCount, maxLength, value, defaultValue, onChange, ...rest }, ref) => {
|
|
144
|
+
var _a;
|
|
145
|
+
const internalRef = useRef(null);
|
|
146
|
+
const textareaRef = (_a = ref) !== null && _a !== void 0 ? _a : internalRef;
|
|
147
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
148
|
+
id,
|
|
149
|
+
helperText,
|
|
150
|
+
errorMessage,
|
|
151
|
+
validationState,
|
|
152
|
+
required,
|
|
153
|
+
disabled,
|
|
154
|
+
});
|
|
155
|
+
const [charCount, setCharCount] = React.useState(() => {
|
|
156
|
+
var _a;
|
|
157
|
+
const initial = (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : '';
|
|
158
|
+
return String(initial).length;
|
|
159
|
+
});
|
|
160
|
+
const handleChange = useCallback((e) => {
|
|
161
|
+
setCharCount(e.target.value.length);
|
|
162
|
+
if (autoResize && textareaRef.current) {
|
|
163
|
+
textareaRef.current.style.height = 'auto';
|
|
164
|
+
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
|
165
|
+
}
|
|
166
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
167
|
+
}, [autoResize, onChange, textareaRef]);
|
|
168
|
+
const activeMessage = validationState === 'error'
|
|
169
|
+
? errorMessage
|
|
170
|
+
: validationState === 'success'
|
|
171
|
+
? successMessage
|
|
172
|
+
: validationState === 'warning'
|
|
173
|
+
? warningMessage
|
|
174
|
+
: helperText;
|
|
175
|
+
const messageClass = validationState === 'error'
|
|
176
|
+
? styles$h.errorText
|
|
177
|
+
: validationState === 'success'
|
|
178
|
+
? styles$h.successText
|
|
179
|
+
: validationState === 'warning'
|
|
180
|
+
? styles$h.warningText
|
|
181
|
+
: styles$h.helperText;
|
|
182
|
+
const isExceeded = maxLength !== undefined && charCount > maxLength;
|
|
183
|
+
return (jsxs("div", { className: classNames(styles$h.wrapper, styles$h[size], styles$h[variant], validationState !== 'default' ? styles$h[validationState] : undefined, fullWidth ? styles$h.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$h.label, required ? styles$h.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: styles$h.inputWrapper, children: jsx("textarea", { ...rest, ...inputAriaProps, ref: textareaRef, id: inputId, disabled: disabled, readOnly: readOnly, required: required, maxLength: maxLength, value: value, defaultValue: defaultValue, onChange: handleChange, className: classNames(styles$h.input, autoResize ? styles$h.autoResize : undefined, inputClassName, className), style: inputStyle }) }), (activeMessage || showCharCount) && (jsxs("div", { className: styles$h.footer, children: [activeMessage ? (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage })) : (jsx("span", {})), showCharCount && (jsx("span", { className: classNames(styles$h.charCount, isExceeded ? styles$h.charCountExceeded : undefined), children: maxLength !== undefined ? `${charCount}/${maxLength}` : charCount }))] }))] }));
|
|
184
|
+
});
|
|
185
|
+
TextArea.displayName = 'TextArea';
|
|
186
|
+
|
|
187
|
+
var css_248z$g = ".NumberInput-module_wrapper__Cd82l {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.NumberInput-module_fullWidth__CiS2F {\n width: 100%;\n}\n\n.NumberInput-module_label__fyNSO {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.NumberInput-module_required__1ewMt::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.NumberInput-module_inputWrapper__yHfPf {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.NumberInput-module_input__Ss8p7 {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n -moz-appearance: textfield;\n}\n\n.NumberInput-module_input__Ss8p7::-webkit-inner-spin-button,\n.NumberInput-module_input__Ss8p7::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.NumberInput-module_input__Ss8p7::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.NumberInput-module_sm__p2G3q .NumberInput-module_input__Ss8p7 {\n padding: 6px 10px;\n font-size: 0.75rem;\n height: 32px;\n}\n\n.NumberInput-module_md__8J0Mb .NumberInput-module_input__Ss8p7 {\n padding: 8px 12px;\n font-size: 0.875rem;\n height: 40px;\n}\n\n.NumberInput-module_lg__oLOi- .NumberInput-module_input__Ss8p7 {\n padding: 10px 16px;\n font-size: 1rem;\n height: 48px;\n}\n\n.NumberInput-module_hasControls__xlqy8 .NumberInput-module_input__Ss8p7 {\n padding-right: 40px;\n}\n\n.NumberInput-module_outlined__qw--3 .NumberInput-module_input__Ss8p7 {\n border: 1px solid var(--input-border-color);\n}\n\n.NumberInput-module_outlined__qw--3 .NumberInput-module_input__Ss8p7:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.NumberInput-module_outlined__qw--3 .NumberInput-module_input__Ss8p7:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.NumberInput-module_filled__uY4SE .NumberInput-module_input__Ss8p7 {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.NumberInput-module_filled__uY4SE .NumberInput-module_input__Ss8p7:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.NumberInput-module_filled__uY4SE .NumberInput-module_input__Ss8p7:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.NumberInput-module_underlined__zVPeD .NumberInput-module_input__Ss8p7 {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n}\n\n.NumberInput-module_underlined__zVPeD .NumberInput-module_input__Ss8p7:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.NumberInput-module_underlined__zVPeD .NumberInput-module_input__Ss8p7:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n.NumberInput-module_error__-r8V- .NumberInput-module_input__Ss8p7 {\n border-color: var(--input-error-color) !important;\n}\n\n.NumberInput-module_error__-r8V- .NumberInput-module_input__Ss8p7:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.NumberInput-module_success__ha9Nv .NumberInput-module_input__Ss8p7 {\n border-color: var(--input-success-color) !important;\n}\n\n.NumberInput-module_success__ha9Nv .NumberInput-module_input__Ss8p7:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.NumberInput-module_warning__6ryvV .NumberInput-module_input__Ss8p7 {\n border-color: var(--input-warning-color) !important;\n}\n\n.NumberInput-module_warning__6ryvV .NumberInput-module_input__Ss8p7:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n.NumberInput-module_input__Ss8p7:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.NumberInput-module_controls__8UfQ2 {\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--input-border-color);\n}\n\n.NumberInput-module_controlBtn__nJrGV {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--input-text-color);\n font-size: 0.625rem;\n padding: 0 6px;\n transition: background-color 0.1s ease;\n line-height: 1;\n}\n\n.NumberInput-module_controlBtn__nJrGV:hover:not(:disabled) {\n background-color: #f3f4f6;\n}\n\n.NumberInput-module_controlBtn__nJrGV:disabled {\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.NumberInput-module_controlBtn__nJrGV + .NumberInput-module_controlBtn__nJrGV {\n border-top: 1px solid var(--input-border-color);\n}\n\n.NumberInput-module_helperText__0tllq {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.NumberInput-module_errorText__FDg9z {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n\n.NumberInput-module_successText__ApMoU {\n font-size: 0.75rem;\n color: var(--input-success-color);\n}\n\n.NumberInput-module_warningText__4Jluc {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n}\n";
|
|
188
|
+
var styles$g = {"wrapper":"NumberInput-module_wrapper__Cd82l","fullWidth":"NumberInput-module_fullWidth__CiS2F","label":"NumberInput-module_label__fyNSO","required":"NumberInput-module_required__1ewMt","inputWrapper":"NumberInput-module_inputWrapper__yHfPf","input":"NumberInput-module_input__Ss8p7","sm":"NumberInput-module_sm__p2G3q","md":"NumberInput-module_md__8J0Mb","lg":"NumberInput-module_lg__oLOi-","hasControls":"NumberInput-module_hasControls__xlqy8","outlined":"NumberInput-module_outlined__qw--3","filled":"NumberInput-module_filled__uY4SE","underlined":"NumberInput-module_underlined__zVPeD","error":"NumberInput-module_error__-r8V-","success":"NumberInput-module_success__ha9Nv","warning":"NumberInput-module_warning__6ryvV","controls":"NumberInput-module_controls__8UfQ2","controlBtn":"NumberInput-module_controlBtn__nJrGV","helperText":"NumberInput-module_helperText__0tllq","errorText":"NumberInput-module_errorText__FDg9z","successText":"NumberInput-module_successText__ApMoU","warningText":"NumberInput-module_warningText__4Jluc"};
|
|
189
|
+
styleInject(css_248z$g);
|
|
190
|
+
|
|
191
|
+
const NumberInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, value, defaultValue, onChange, min, max, step = 1, hideControls, placeholder, ...rest }, ref) => {
|
|
192
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
193
|
+
id,
|
|
194
|
+
helperText,
|
|
195
|
+
errorMessage,
|
|
196
|
+
validationState,
|
|
197
|
+
required,
|
|
198
|
+
disabled,
|
|
199
|
+
});
|
|
200
|
+
const [currentValue, setCurrentValue] = useControllable({
|
|
201
|
+
value,
|
|
202
|
+
defaultValue,
|
|
203
|
+
onChange,
|
|
204
|
+
});
|
|
205
|
+
const clamp = useCallback((n) => {
|
|
206
|
+
let clamped = n;
|
|
207
|
+
if (min !== undefined)
|
|
208
|
+
clamped = Math.max(min, clamped);
|
|
209
|
+
if (max !== undefined)
|
|
210
|
+
clamped = Math.min(max, clamped);
|
|
211
|
+
return clamped;
|
|
212
|
+
}, [min, max]);
|
|
213
|
+
const handleIncrement = useCallback(() => {
|
|
214
|
+
const next = clamp((currentValue !== null && currentValue !== void 0 ? currentValue : 0) + (step !== null && step !== void 0 ? step : 1));
|
|
215
|
+
setCurrentValue(next);
|
|
216
|
+
}, [currentValue, step, clamp, setCurrentValue]);
|
|
217
|
+
const handleDecrement = useCallback(() => {
|
|
218
|
+
const next = clamp((currentValue !== null && currentValue !== void 0 ? currentValue : 0) - (step !== null && step !== void 0 ? step : 1));
|
|
219
|
+
setCurrentValue(next);
|
|
220
|
+
}, [currentValue, step, clamp, setCurrentValue]);
|
|
221
|
+
const handleChange = useCallback((e) => {
|
|
222
|
+
const raw = e.target.value;
|
|
223
|
+
if (raw === '' || raw === '-') {
|
|
224
|
+
setCurrentValue(undefined);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const parsed = parseFloat(raw);
|
|
228
|
+
if (!isNaN(parsed)) {
|
|
229
|
+
setCurrentValue(parsed);
|
|
230
|
+
}
|
|
231
|
+
}, [setCurrentValue]);
|
|
232
|
+
const activeMessage = validationState === 'error'
|
|
233
|
+
? errorMessage
|
|
234
|
+
: validationState === 'success'
|
|
235
|
+
? successMessage
|
|
236
|
+
: validationState === 'warning'
|
|
237
|
+
? warningMessage
|
|
238
|
+
: helperText;
|
|
239
|
+
const messageClass = validationState === 'error'
|
|
240
|
+
? styles$g.errorText
|
|
241
|
+
: validationState === 'success'
|
|
242
|
+
? styles$g.successText
|
|
243
|
+
: validationState === 'warning'
|
|
244
|
+
? styles$g.warningText
|
|
245
|
+
: styles$g.helperText;
|
|
246
|
+
const showControls = !hideControls && !readOnly;
|
|
247
|
+
const isAtMin = min !== undefined && (currentValue !== null && currentValue !== void 0 ? currentValue : 0) <= min;
|
|
248
|
+
const isAtMax = max !== undefined && (currentValue !== null && currentValue !== void 0 ? currentValue : 0) >= max;
|
|
249
|
+
return (jsxs("div", { className: classNames(styles$g.wrapper, styles$g[size], styles$g[variant], validationState !== 'default' ? styles$g[validationState] : undefined, fullWidth ? styles$g.fullWidth : undefined, showControls ? styles$g.hasControls : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$g.label, required ? styles$g.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$g.inputWrapper, children: [jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "number", disabled: disabled, readOnly: readOnly, required: required, min: min, max: max, step: step, placeholder: placeholder, value: currentValue !== undefined ? currentValue : '', onChange: handleChange, className: classNames(styles$g.input, inputClassName, className), style: inputStyle }), showControls && (jsxs("div", { className: styles$g.controls, children: [jsx("button", { type: "button", className: styles$g.controlBtn, onClick: handleIncrement, disabled: disabled || isAtMax, "aria-label": "Increment", tabIndex: -1, children: "\u25B2" }), jsx("button", { type: "button", className: styles$g.controlBtn, onClick: handleDecrement, disabled: disabled || isAtMin, "aria-label": "Decrement", tabIndex: -1, children: "\u25BC" })] }))] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
250
|
+
});
|
|
251
|
+
NumberInput.displayName = 'NumberInput';
|
|
252
|
+
|
|
253
|
+
var css_248z$f = ".PasswordInput-module_wrapper__zEU-L {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.PasswordInput-module_fullWidth__DWkhh {\n width: 100%;\n}\n\n.PasswordInput-module_label__ps3gD {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.PasswordInput-module_required__pGrok::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.PasswordInput-module_inputWrapper__iBTIJ {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.PasswordInput-module_input__FWEvb {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n padding-right: 40px;\n}\n\n.PasswordInput-module_input__FWEvb::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.PasswordInput-module_sm__3-CZz .PasswordInput-module_input__FWEvb {\n padding: 6px 40px 6px 10px;\n font-size: 0.75rem;\n height: 32px;\n}\n\n.PasswordInput-module_md__ReV0O .PasswordInput-module_input__FWEvb {\n padding: 8px 40px 8px 12px;\n font-size: 0.875rem;\n height: 40px;\n}\n\n.PasswordInput-module_lg__DiTiB .PasswordInput-module_input__FWEvb {\n padding: 10px 40px 10px 16px;\n font-size: 1rem;\n height: 48px;\n}\n\n.PasswordInput-module_outlined__rHezs .PasswordInput-module_input__FWEvb {\n border: 1px solid var(--input-border-color);\n}\n\n.PasswordInput-module_outlined__rHezs .PasswordInput-module_input__FWEvb:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.PasswordInput-module_outlined__rHezs .PasswordInput-module_input__FWEvb:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.PasswordInput-module_filled__8FYu5 .PasswordInput-module_input__FWEvb {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.PasswordInput-module_filled__8FYu5 .PasswordInput-module_input__FWEvb:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.PasswordInput-module_filled__8FYu5 .PasswordInput-module_input__FWEvb:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.PasswordInput-module_underlined__TyF25 .PasswordInput-module_input__FWEvb {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n}\n\n.PasswordInput-module_underlined__TyF25 .PasswordInput-module_input__FWEvb:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.PasswordInput-module_underlined__TyF25 .PasswordInput-module_input__FWEvb:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n.PasswordInput-module_error__QdIFf .PasswordInput-module_input__FWEvb {\n border-color: var(--input-error-color) !important;\n}\n\n.PasswordInput-module_error__QdIFf .PasswordInput-module_input__FWEvb:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.PasswordInput-module_success__gIUkQ .PasswordInput-module_input__FWEvb {\n border-color: var(--input-success-color) !important;\n}\n\n.PasswordInput-module_success__gIUkQ .PasswordInput-module_input__FWEvb:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.PasswordInput-module_warning__pPuhN .PasswordInput-module_input__FWEvb {\n border-color: var(--input-warning-color) !important;\n}\n\n.PasswordInput-module_warning__pPuhN .PasswordInput-module_input__FWEvb:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n.PasswordInput-module_input__FWEvb:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.PasswordInput-module_toggleBtn__2egfq {\n position: absolute;\n right: 10px;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--input-placeholder-color);\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.15s ease;\n}\n\n.PasswordInput-module_toggleBtn__2egfq:hover {\n color: var(--input-text-color);\n}\n\n.PasswordInput-module_toggleBtn__2egfq:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.PasswordInput-module_strengthBar__PAPHR {\n display: flex;\n gap: 4px;\n margin-top: 4px;\n}\n\n.PasswordInput-module_strengthSegment__EznE5 {\n flex: 1;\n height: 4px;\n border-radius: 2px;\n background-color: #e5e7eb;\n transition: background-color 0.3s ease;\n}\n\n.PasswordInput-module_strength0__AVibk .PasswordInput-module_strengthSegment__EznE5 {\n background-color: #e5e7eb;\n}\n\n.PasswordInput-module_strength1__E2iS6 .PasswordInput-module_strengthSegment__EznE5:nth-child(1) {\n background-color: var(--input-error-color);\n}\n\n.PasswordInput-module_strength2__GWibw .PasswordInput-module_strengthSegment__EznE5:nth-child(-n+2) {\n background-color: var(--input-warning-color);\n}\n\n.PasswordInput-module_strength3__DvKqs .PasswordInput-module_strengthSegment__EznE5:nth-child(-n+3) {\n background-color: #3b82f6;\n}\n\n.PasswordInput-module_strength4__XPt5W .PasswordInput-module_strengthSegment__EznE5 {\n background-color: var(--input-success-color);\n}\n\n.PasswordInput-module_strengthLabel__u9QHS {\n font-size: 0.75rem;\n color: #6b7280;\n margin-top: 2px;\n}\n\n.PasswordInput-module_helperText__MXkZe {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.PasswordInput-module_errorText__73Uvv {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n\n.PasswordInput-module_successText__1-NXP {\n font-size: 0.75rem;\n color: var(--input-success-color);\n}\n\n.PasswordInput-module_warningText__vIY-N {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n}\n";
|
|
254
|
+
var styles$f = {"wrapper":"PasswordInput-module_wrapper__zEU-L","fullWidth":"PasswordInput-module_fullWidth__DWkhh","label":"PasswordInput-module_label__ps3gD","required":"PasswordInput-module_required__pGrok","inputWrapper":"PasswordInput-module_inputWrapper__iBTIJ","input":"PasswordInput-module_input__FWEvb","sm":"PasswordInput-module_sm__3-CZz","md":"PasswordInput-module_md__ReV0O","lg":"PasswordInput-module_lg__DiTiB","outlined":"PasswordInput-module_outlined__rHezs","filled":"PasswordInput-module_filled__8FYu5","underlined":"PasswordInput-module_underlined__TyF25","error":"PasswordInput-module_error__QdIFf","success":"PasswordInput-module_success__gIUkQ","warning":"PasswordInput-module_warning__pPuhN","toggleBtn":"PasswordInput-module_toggleBtn__2egfq","strengthBar":"PasswordInput-module_strengthBar__PAPHR","strengthSegment":"PasswordInput-module_strengthSegment__EznE5","strength0":"PasswordInput-module_strength0__AVibk","strength1":"PasswordInput-module_strength1__E2iS6","strength2":"PasswordInput-module_strength2__GWibw","strength3":"PasswordInput-module_strength3__DvKqs","strength4":"PasswordInput-module_strength4__XPt5W","strengthLabel":"PasswordInput-module_strengthLabel__u9QHS","helperText":"PasswordInput-module_helperText__MXkZe","errorText":"PasswordInput-module_errorText__73Uvv","successText":"PasswordInput-module_successText__1-NXP","warningText":"PasswordInput-module_warningText__vIY-N"};
|
|
255
|
+
styleInject(css_248z$f);
|
|
256
|
+
|
|
257
|
+
function getPasswordStrength(password) {
|
|
258
|
+
if (!password)
|
|
259
|
+
return 0;
|
|
260
|
+
let score = 0;
|
|
261
|
+
if (password.length >= 8)
|
|
262
|
+
score++;
|
|
263
|
+
if (/[A-Z]/.test(password))
|
|
264
|
+
score++;
|
|
265
|
+
if (/[0-9]/.test(password))
|
|
266
|
+
score++;
|
|
267
|
+
if (/[^A-Za-z0-9]/.test(password))
|
|
268
|
+
score++;
|
|
269
|
+
return score;
|
|
270
|
+
}
|
|
271
|
+
const STRENGTH_LABELS = ['', 'Weak', 'Fair', 'Good', 'Strong'];
|
|
272
|
+
const PasswordInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, showStrengthIndicator, showIcon, hideIcon, value, defaultValue, onChange, ...rest }, ref) => {
|
|
273
|
+
var _a;
|
|
274
|
+
const [visible, setVisible] = useState(false);
|
|
275
|
+
const [internalValue, setInternalValue] = useState((_a = defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
276
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
277
|
+
id,
|
|
278
|
+
helperText,
|
|
279
|
+
errorMessage,
|
|
280
|
+
validationState,
|
|
281
|
+
required,
|
|
282
|
+
disabled,
|
|
283
|
+
});
|
|
284
|
+
const currentValue = value !== undefined ? value : internalValue;
|
|
285
|
+
const handleChange = useCallback((e) => {
|
|
286
|
+
if (value === undefined) {
|
|
287
|
+
setInternalValue(e.target.value);
|
|
288
|
+
}
|
|
289
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
290
|
+
}, [value, onChange]);
|
|
291
|
+
const strength = showStrengthIndicator ? getPasswordStrength(currentValue) : 0;
|
|
292
|
+
const activeMessage = validationState === 'error'
|
|
293
|
+
? errorMessage
|
|
294
|
+
: validationState === 'success'
|
|
295
|
+
? successMessage
|
|
296
|
+
: validationState === 'warning'
|
|
297
|
+
? warningMessage
|
|
298
|
+
: helperText;
|
|
299
|
+
const messageClass = validationState === 'error'
|
|
300
|
+
? styles$f.errorText
|
|
301
|
+
: validationState === 'success'
|
|
302
|
+
? styles$f.successText
|
|
303
|
+
: validationState === 'warning'
|
|
304
|
+
? styles$f.warningText
|
|
305
|
+
: styles$f.helperText;
|
|
306
|
+
return (jsxs("div", { className: classNames(styles$f.wrapper, styles$f[size], styles$f[variant], validationState !== 'default' ? styles$f[validationState] : undefined, fullWidth ? styles$f.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$f.label, required ? styles$f.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$f.inputWrapper, children: [jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: visible ? 'text' : 'password', disabled: disabled, readOnly: readOnly, required: required, value: value !== undefined ? value : internalValue, onChange: handleChange, className: classNames(styles$f.input, inputClassName, className), style: inputStyle }), jsx("button", { type: "button", className: styles$f.toggleBtn, onClick: () => setVisible((v) => !v), disabled: disabled, "aria-label": visible ? 'Hide password' : 'Show password', tabIndex: -1, children: visible
|
|
307
|
+
? (hideIcon !== null && hideIcon !== void 0 ? hideIcon : jsx("span", { children: "\uD83D\uDE48" }))
|
|
308
|
+
: (showIcon !== null && showIcon !== void 0 ? showIcon : jsx("span", { children: "\uD83D\uDC41" })) })] }), showStrengthIndicator && currentValue.length > 0 && (jsxs(Fragment, { children: [jsx("div", { className: classNames(styles$f.strengthBar, styles$f[`strength${strength}`]), children: [1, 2, 3, 4].map((i) => (jsx("div", { className: styles$f.strengthSegment }, i))) }), jsx("span", { className: styles$f.strengthLabel, children: STRENGTH_LABELS[strength] })] })), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
309
|
+
});
|
|
310
|
+
PasswordInput.displayName = 'PasswordInput';
|
|
311
|
+
|
|
312
|
+
var css_248z$e = ".SelectInput-module_wrapper__2Sa1I {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.SelectInput-module_fullWidth__Uxy2x {\n width: 100%;\n}\n\n.SelectInput-module_label__XSFuZ {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.SelectInput-module_required__yanj5::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.SelectInput-module_inputWrapper__wyLVU {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.SelectInput-module_input__MHG7u {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n padding-right: 36px;\n}\n\n.SelectInput-module_arrow__o6835 {\n position: absolute;\n right: 10px;\n pointer-events: none;\n color: var(--input-placeholder-color);\n display: flex;\n align-items: center;\n}\n\n.SelectInput-module_sm__u-ldy .SelectInput-module_input__MHG7u {\n padding: 6px 36px 6px 10px;\n font-size: 0.75rem;\n height: 32px;\n}\n\n.SelectInput-module_md__j4xAN .SelectInput-module_input__MHG7u {\n padding: 8px 36px 8px 12px;\n font-size: 0.875rem;\n height: 40px;\n}\n\n.SelectInput-module_lg__7cLZ3 .SelectInput-module_input__MHG7u {\n padding: 10px 36px 10px 16px;\n font-size: 1rem;\n height: 48px;\n}\n\n.SelectInput-module_outlined__4iiDL .SelectInput-module_input__MHG7u {\n border: 1px solid var(--input-border-color);\n}\n\n.SelectInput-module_outlined__4iiDL .SelectInput-module_input__MHG7u:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.SelectInput-module_outlined__4iiDL .SelectInput-module_input__MHG7u:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.SelectInput-module_filled__O-v4z .SelectInput-module_input__MHG7u {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.SelectInput-module_filled__O-v4z .SelectInput-module_input__MHG7u:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.SelectInput-module_filled__O-v4z .SelectInput-module_input__MHG7u:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.SelectInput-module_underlined__nhbMF .SelectInput-module_input__MHG7u {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n}\n\n.SelectInput-module_underlined__nhbMF .SelectInput-module_input__MHG7u:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.SelectInput-module_underlined__nhbMF .SelectInput-module_input__MHG7u:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n.SelectInput-module_error__QGP-5 .SelectInput-module_input__MHG7u {\n border-color: var(--input-error-color) !important;\n}\n\n.SelectInput-module_error__QGP-5 .SelectInput-module_input__MHG7u:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.SelectInput-module_success__U-U37 .SelectInput-module_input__MHG7u {\n border-color: var(--input-success-color) !important;\n}\n\n.SelectInput-module_success__U-U37 .SelectInput-module_input__MHG7u:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.SelectInput-module_warning__coH4N .SelectInput-module_input__MHG7u {\n border-color: var(--input-warning-color) !important;\n}\n\n.SelectInput-module_warning__coH4N .SelectInput-module_input__MHG7u:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n.SelectInput-module_input__MHG7u:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.SelectInput-module_placeholderOption__33EfK {\n color: var(--input-placeholder-color);\n}\n\n.SelectInput-module_helperText__SN7ny {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.SelectInput-module_errorText__RTSlz {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n\n.SelectInput-module_successText__SlHSc {\n font-size: 0.75rem;\n color: var(--input-success-color);\n}\n\n.SelectInput-module_warningText__5RI8k {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n}\n";
|
|
313
|
+
var styles$e = {"wrapper":"SelectInput-module_wrapper__2Sa1I","fullWidth":"SelectInput-module_fullWidth__Uxy2x","label":"SelectInput-module_label__XSFuZ","required":"SelectInput-module_required__yanj5","inputWrapper":"SelectInput-module_inputWrapper__wyLVU","input":"SelectInput-module_input__MHG7u","arrow":"SelectInput-module_arrow__o6835","sm":"SelectInput-module_sm__u-ldy","md":"SelectInput-module_md__j4xAN","lg":"SelectInput-module_lg__7cLZ3","outlined":"SelectInput-module_outlined__4iiDL","filled":"SelectInput-module_filled__O-v4z","underlined":"SelectInput-module_underlined__nhbMF","error":"SelectInput-module_error__QGP-5","success":"SelectInput-module_success__U-U37","warning":"SelectInput-module_warning__coH4N","placeholderOption":"SelectInput-module_placeholderOption__33EfK","helperText":"SelectInput-module_helperText__SN7ny","errorText":"SelectInput-module_errorText__RTSlz","successText":"SelectInput-module_successText__SlHSc","warningText":"SelectInput-module_warningText__5RI8k"};
|
|
314
|
+
styleInject(css_248z$e);
|
|
315
|
+
|
|
316
|
+
const SelectInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly: _readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, options, placeholder, ...rest }, ref) => {
|
|
317
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
318
|
+
id,
|
|
319
|
+
helperText,
|
|
320
|
+
errorMessage,
|
|
321
|
+
validationState,
|
|
322
|
+
required,
|
|
323
|
+
disabled,
|
|
324
|
+
});
|
|
325
|
+
const activeMessage = validationState === 'error'
|
|
326
|
+
? errorMessage
|
|
327
|
+
: validationState === 'success'
|
|
328
|
+
? successMessage
|
|
329
|
+
: validationState === 'warning'
|
|
330
|
+
? warningMessage
|
|
331
|
+
: helperText;
|
|
332
|
+
const messageClass = validationState === 'error'
|
|
333
|
+
? styles$e.errorText
|
|
334
|
+
: validationState === 'success'
|
|
335
|
+
? styles$e.successText
|
|
336
|
+
: validationState === 'warning'
|
|
337
|
+
? styles$e.warningText
|
|
338
|
+
: styles$e.helperText;
|
|
339
|
+
return (jsxs("div", { className: classNames(styles$e.wrapper, styles$e[size], styles$e[variant], validationState !== 'default' ? styles$e[validationState] : undefined, fullWidth ? styles$e.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$e.label, required ? styles$e.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$e.inputWrapper, children: [jsxs("select", { ...rest, ...inputAriaProps, ref: ref, id: inputId, disabled: disabled, required: required, className: classNames(styles$e.input, inputClassName, className), style: inputStyle, children: [placeholder && (jsx("option", { value: "", disabled: true, className: styles$e.placeholderOption, children: placeholder })), options.map((opt) => (jsx("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)))] }), jsx("span", { className: styles$e.arrow, children: "\u25BE" })] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
340
|
+
});
|
|
341
|
+
SelectInput.displayName = 'SelectInput';
|
|
342
|
+
|
|
343
|
+
var css_248z$d = ".Checkbox-module_wrapper__rpthW {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-border-radius: 4px;\n --input-font-family: inherit;\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.Checkbox-module_checkboxRow__CtGUR {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n cursor: pointer;\n}\n\n.Checkbox-module_checkboxRow__CtGUR.Checkbox-module_disabled__x7-eg {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.Checkbox-module_input__2kt-h {\n position: relative;\n appearance: none;\n -webkit-appearance: none;\n width: 16px;\n height: 16px;\n min-width: 16px;\n min-height: 16px;\n border: 2px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n background-color: var(--input-bg-color);\n cursor: pointer;\n transition: border-color 0.15s ease, background-color 0.15s ease;\n outline: none;\n flex-shrink: 0;\n margin: 0;\n}\n\n.Checkbox-module_sm__2pjJ9 .Checkbox-module_input__2kt-h {\n width: 14px;\n height: 14px;\n min-width: 14px;\n min-height: 14px;\n}\n\n.Checkbox-module_lg__lIue0 .Checkbox-module_input__2kt-h {\n width: 20px;\n height: 20px;\n min-width: 20px;\n min-height: 20px;\n}\n\n.Checkbox-module_input__2kt-h:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.Checkbox-module_input__2kt-h:focus-visible {\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);\n}\n\n.Checkbox-module_input__2kt-h:checked {\n background-color: var(--input-primary-color);\n border-color: var(--input-primary-color);\n}\n\n.Checkbox-module_input__2kt-h:checked::after {\n content: '';\n position: absolute;\n left: 3px;\n top: 0px;\n width: 5px;\n height: 9px;\n border: 2px solid #fff;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\n\n.Checkbox-module_sm__2pjJ9 .Checkbox-module_input__2kt-h:checked::after {\n left: 2px;\n top: 0px;\n width: 4px;\n height: 7px;\n}\n\n.Checkbox-module_lg__lIue0 .Checkbox-module_input__2kt-h:checked::after {\n left: 4px;\n top: 1px;\n width: 7px;\n height: 11px;\n}\n\n.Checkbox-module_input__2kt-h:indeterminate {\n background-color: var(--input-primary-color);\n border-color: var(--input-primary-color);\n}\n\n.Checkbox-module_input__2kt-h:indeterminate::after {\n content: '';\n position: absolute;\n left: 2px;\n top: 5px;\n width: 8px;\n height: 2px;\n background-color: #fff;\n}\n\n.Checkbox-module_input__2kt-h:disabled {\n background-color: var(--input-disabled-bg);\n border-color: #d1d5db;\n cursor: not-allowed;\n}\n\n.Checkbox-module_error__E-bmD .Checkbox-module_input__2kt-h {\n border-color: var(--input-error-color);\n}\n\n.Checkbox-module_label__cwRtI {\n font-size: 0.875rem;\n color: var(--input-text-color);\n line-height: 1.4;\n}\n\n.Checkbox-module_sm__2pjJ9 .Checkbox-module_label__cwRtI {\n font-size: 0.75rem;\n}\n\n.Checkbox-module_lg__lIue0 .Checkbox-module_label__cwRtI {\n font-size: 1rem;\n}\n\n.Checkbox-module_required__t9DLN::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.Checkbox-module_helperText__-2pe1 {\n font-size: 0.75rem;\n color: #6b7280;\n margin-left: 24px;\n}\n\n.Checkbox-module_errorText__ARqRg {\n font-size: 0.75rem;\n color: var(--input-error-color);\n margin-left: 24px;\n}\n";
|
|
344
|
+
var styles$d = {"wrapper":"Checkbox-module_wrapper__rpthW","checkboxRow":"Checkbox-module_checkboxRow__CtGUR","disabled":"Checkbox-module_disabled__x7-eg","input":"Checkbox-module_input__2kt-h","sm":"Checkbox-module_sm__2pjJ9","lg":"Checkbox-module_lg__lIue0","error":"Checkbox-module_error__E-bmD","label":"Checkbox-module_label__cwRtI","required":"Checkbox-module_required__t9DLN","helperText":"Checkbox-module_helperText__-2pe1","errorText":"Checkbox-module_errorText__ARqRg"};
|
|
345
|
+
styleInject(css_248z$d);
|
|
346
|
+
|
|
347
|
+
const Checkbox = forwardRef(({ size = 'md', validationState = 'default', label, helperText, errorMessage, required, disabled, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, indeterminate, className, ...rest }, ref) => {
|
|
348
|
+
var _a;
|
|
349
|
+
const internalRef = useRef(null);
|
|
350
|
+
const checkboxRef = (_a = ref) !== null && _a !== void 0 ? _a : internalRef;
|
|
351
|
+
const { inputId, helperId, inputAriaProps } = useFormField({
|
|
352
|
+
id,
|
|
353
|
+
helperText,
|
|
354
|
+
errorMessage,
|
|
355
|
+
validationState,
|
|
356
|
+
required,
|
|
357
|
+
disabled,
|
|
358
|
+
});
|
|
359
|
+
useEffect(() => {
|
|
360
|
+
if (checkboxRef.current) {
|
|
361
|
+
checkboxRef.current.indeterminate = indeterminate !== null && indeterminate !== void 0 ? indeterminate : false;
|
|
362
|
+
}
|
|
363
|
+
}, [indeterminate, checkboxRef]);
|
|
364
|
+
const activeMessage = validationState === 'error' ? errorMessage : helperText;
|
|
365
|
+
const messageClass = validationState === 'error' ? styles$d.errorText : styles$d.helperText;
|
|
366
|
+
return (jsxs("div", { className: classNames(styles$d.wrapper, styles$d[size], validationState === 'error' ? styles$d.error : undefined, wrapperClassName), style: wrapperStyle, children: [jsxs("label", { className: classNames(styles$d.checkboxRow, disabled ? styles$d.disabled : undefined), style: labelStyle, children: [jsx("input", { ...rest, ...inputAriaProps, ref: checkboxRef, id: inputId, type: "checkbox", disabled: disabled, required: required, className: classNames(styles$d.input, inputClassName, className), style: inputStyle }), label && (jsx("span", { className: classNames(styles$d.label, required ? styles$d.required : undefined, labelClassName), children: label }))] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
367
|
+
});
|
|
368
|
+
Checkbox.displayName = 'Checkbox';
|
|
369
|
+
|
|
370
|
+
var css_248z$c = ".CheckboxGroup-module_wrapper__44TEs {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-border-color: #d1d5db;\n --input-text-color: #111827;\n --input-font-family: inherit;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n font-family: var(--input-font-family);\n}\n\n.CheckboxGroup-module_fullWidth__MO8rU {\n width: 100%;\n}\n\n.CheckboxGroup-module_groupLabel__8IcWE {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--input-text-color);\n}\n\n.CheckboxGroup-module_required__1epKt::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.CheckboxGroup-module_optionsWrapper__JQHgx {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.CheckboxGroup-module_horizontal__myCqF {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n\n.CheckboxGroup-module_helperText__p2M3v {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.CheckboxGroup-module_errorText__sDVQ7 {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n";
|
|
371
|
+
var styles$c = {"wrapper":"CheckboxGroup-module_wrapper__44TEs","groupLabel":"CheckboxGroup-module_groupLabel__8IcWE","required":"CheckboxGroup-module_required__1epKt","optionsWrapper":"CheckboxGroup-module_optionsWrapper__JQHgx","horizontal":"CheckboxGroup-module_horizontal__myCqF","helperText":"CheckboxGroup-module_helperText__p2M3v","errorText":"CheckboxGroup-module_errorText__sDVQ7"};
|
|
372
|
+
styleInject(css_248z$c);
|
|
373
|
+
|
|
374
|
+
const CheckboxGroup = forwardRef(({ size = 'md', validationState = 'default', label, helperText, errorMessage, required, disabled, wrapperClassName, wrapperStyle, labelClassName, labelStyle, helperTextClassName, helperTextStyle, id, options, value, defaultValue, onChange, direction = 'vertical', }, ref) => {
|
|
375
|
+
const generatedId = useId();
|
|
376
|
+
const groupId = id !== null && id !== void 0 ? id : `checkbox-group-${generatedId}`;
|
|
377
|
+
const helperId = `${groupId}-helper`;
|
|
378
|
+
const [selectedValues, setSelectedValues] = useControllable({
|
|
379
|
+
value,
|
|
380
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : [],
|
|
381
|
+
onChange,
|
|
382
|
+
});
|
|
383
|
+
const handleChange = (optionValue, checked) => {
|
|
384
|
+
const current = selectedValues !== null && selectedValues !== void 0 ? selectedValues : [];
|
|
385
|
+
const next = checked
|
|
386
|
+
? [...current, optionValue]
|
|
387
|
+
: current.filter((v) => v !== optionValue);
|
|
388
|
+
setSelectedValues(next);
|
|
389
|
+
};
|
|
390
|
+
const activeMessage = validationState === 'error' ? errorMessage : helperText;
|
|
391
|
+
const messageClass = validationState === 'error' ? styles$c.errorText : styles$c.helperText;
|
|
392
|
+
return (jsxs("div", { ref: ref, role: "group", "aria-labelledby": label ? `${groupId}-label` : undefined, "aria-describedby": activeMessage ? helperId : undefined, className: classNames(styles$c.wrapper, wrapperClassName), style: wrapperStyle, children: [label && (jsx("span", { id: `${groupId}-label`, className: classNames(styles$c.groupLabel, required ? styles$c.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: classNames(styles$c.optionsWrapper, direction === 'horizontal' ? styles$c.horizontal : undefined), children: options.map((opt) => (jsx(Checkbox, { id: `${groupId}-${opt.value}`, label: opt.label, size: size, disabled: disabled || opt.disabled, checked: (selectedValues !== null && selectedValues !== void 0 ? selectedValues : []).includes(opt.value), onChange: (e) => handleChange(opt.value, e.target.checked), validationState: validationState }, opt.value))) }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
393
|
+
});
|
|
394
|
+
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
395
|
+
|
|
396
|
+
var css_248z$b = ".RadioGroup-module_wrapper__fzRcA {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-text-color: #111827;\n --input-border-color: #d1d5db;\n --input-font-family: inherit;\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n font-family: var(--input-font-family);\n}\n\n.RadioGroup-module_groupLabel__xqi-9 {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--input-text-color);\n}\n\n.RadioGroup-module_required__9kFI3::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.RadioGroup-module_optionsWrapper__iWJHD {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.RadioGroup-module_horizontal__vsHUV {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n\n.RadioGroup-module_radioRow__kIJs1 {\n display: flex;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n}\n\n.RadioGroup-module_radioRow__kIJs1.RadioGroup-module_disabled__tibJb {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.RadioGroup-module_input__qkBm0 {\n position: relative;\n appearance: none;\n -webkit-appearance: none;\n width: 16px;\n height: 16px;\n min-width: 16px;\n border: 2px solid var(--input-border-color);\n border-radius: 50%;\n background-color: #ffffff;\n cursor: pointer;\n transition: border-color 0.15s ease;\n outline: none;\n flex-shrink: 0;\n margin: 0;\n}\n\n.RadioGroup-module_sm__VOJtL .RadioGroup-module_input__qkBm0 {\n width: 14px;\n height: 14px;\n min-width: 14px;\n}\n\n.RadioGroup-module_lg__phnZ9 .RadioGroup-module_input__qkBm0 {\n width: 20px;\n height: 20px;\n min-width: 20px;\n}\n\n.RadioGroup-module_input__qkBm0:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.RadioGroup-module_input__qkBm0:focus-visible {\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);\n}\n\n.RadioGroup-module_input__qkBm0:checked {\n border-color: var(--input-primary-color);\n}\n\n.RadioGroup-module_input__qkBm0:checked::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--input-primary-color);\n}\n\n.RadioGroup-module_sm__VOJtL .RadioGroup-module_input__qkBm0:checked::after {\n width: 6px;\n height: 6px;\n}\n\n.RadioGroup-module_lg__phnZ9 .RadioGroup-module_input__qkBm0:checked::after {\n width: 10px;\n height: 10px;\n}\n\n.RadioGroup-module_input__qkBm0:disabled {\n background-color: var(--input-disabled-bg);\n border-color: #d1d5db;\n cursor: not-allowed;\n}\n\n.RadioGroup-module_error__lrqsC .RadioGroup-module_input__qkBm0 {\n border-color: var(--input-error-color);\n}\n\n.RadioGroup-module_radioLabel__ceNBE {\n font-size: 0.875rem;\n color: var(--input-text-color);\n line-height: 1.4;\n}\n\n.RadioGroup-module_sm__VOJtL .RadioGroup-module_radioLabel__ceNBE {\n font-size: 0.75rem;\n}\n\n.RadioGroup-module_lg__phnZ9 .RadioGroup-module_radioLabel__ceNBE {\n font-size: 1rem;\n}\n\n.RadioGroup-module_helperText__BAR5x {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.RadioGroup-module_errorText__n15-1 {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n";
|
|
397
|
+
var styles$b = {"wrapper":"RadioGroup-module_wrapper__fzRcA","groupLabel":"RadioGroup-module_groupLabel__xqi-9","required":"RadioGroup-module_required__9kFI3","optionsWrapper":"RadioGroup-module_optionsWrapper__iWJHD","horizontal":"RadioGroup-module_horizontal__vsHUV","radioRow":"RadioGroup-module_radioRow__kIJs1","disabled":"RadioGroup-module_disabled__tibJb","input":"RadioGroup-module_input__qkBm0","sm":"RadioGroup-module_sm__VOJtL","lg":"RadioGroup-module_lg__phnZ9","error":"RadioGroup-module_error__lrqsC","radioLabel":"RadioGroup-module_radioLabel__ceNBE","helperText":"RadioGroup-module_helperText__BAR5x","errorText":"RadioGroup-module_errorText__n15-1"};
|
|
398
|
+
styleInject(css_248z$b);
|
|
399
|
+
|
|
400
|
+
const RadioGroup = forwardRef(({ size = 'md', validationState = 'default', label, helperText, errorMessage, required, disabled, wrapperClassName, wrapperStyle, labelClassName, labelStyle, helperTextClassName, helperTextStyle, id, name, options, value, defaultValue, onChange, direction = 'vertical', }, ref) => {
|
|
401
|
+
const generatedId = useId();
|
|
402
|
+
const groupId = id !== null && id !== void 0 ? id : `radio-group-${generatedId}`;
|
|
403
|
+
const helperId = `${groupId}-helper`;
|
|
404
|
+
const [selectedValue, setSelectedValue] = useControllable({
|
|
405
|
+
value,
|
|
406
|
+
defaultValue,
|
|
407
|
+
onChange: onChange,
|
|
408
|
+
});
|
|
409
|
+
const handleChange = (optionValue) => {
|
|
410
|
+
setSelectedValue(optionValue);
|
|
411
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(optionValue);
|
|
412
|
+
};
|
|
413
|
+
const activeMessage = validationState === 'error' ? errorMessage : helperText;
|
|
414
|
+
const messageClass = validationState === 'error' ? styles$b.errorText : styles$b.helperText;
|
|
415
|
+
return (jsxs("div", { ref: ref, role: "radiogroup", "aria-labelledby": label ? `${groupId}-label` : undefined, "aria-describedby": activeMessage ? helperId : undefined, "aria-required": required, className: classNames(styles$b.wrapper, styles$b[size], validationState === 'error' ? styles$b.error : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("span", { id: `${groupId}-label`, className: classNames(styles$b.groupLabel, required ? styles$b.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: classNames(styles$b.optionsWrapper, direction === 'horizontal' ? styles$b.horizontal : undefined), children: options.map((opt) => {
|
|
416
|
+
const optId = `${groupId}-${opt.value}`;
|
|
417
|
+
const isDisabled = disabled || opt.disabled;
|
|
418
|
+
return (jsxs("label", { htmlFor: optId, className: classNames(styles$b.radioRow, isDisabled ? styles$b.disabled : undefined), children: [jsx("input", { id: optId, type: "radio", name: name, value: opt.value, disabled: isDisabled, checked: selectedValue === opt.value, onChange: () => handleChange(opt.value), className: styles$b.input }), jsx("span", { className: styles$b.radioLabel, children: opt.label })] }, opt.value));
|
|
419
|
+
}) }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
420
|
+
});
|
|
421
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
422
|
+
|
|
423
|
+
var css_248z$a = ".Toggle-module_wrapper__BDsrR {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-text-color: #111827;\n --input-border-color: #d1d5db;\n --input-font-family: inherit;\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.Toggle-module_toggleRow__hjzZK {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n user-select: none;\n}\n\n.Toggle-module_toggleRow__hjzZK.Toggle-module_disabled__zqNfH {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.Toggle-module_labelLeft__kifkm {\n flex-direction: row-reverse;\n}\n\n/* Hidden native input */\n.Toggle-module_nativeInput__lSrsx {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n/* The visible track */\n.Toggle-module_track__mMcgG {\n position: relative;\n display: inline-block;\n border-radius: 9999px;\n transition: background-color 0.2s ease;\n flex-shrink: 0;\n background-color: #d1d5db;\n}\n\n.Toggle-module_sm__JTqaB .Toggle-module_track__mMcgG {\n width: 32px;\n height: 18px;\n}\n\n.Toggle-module_md__QfS4K .Toggle-module_track__mMcgG {\n width: 40px;\n height: 22px;\n}\n\n.Toggle-module_lg__ajzsM .Toggle-module_track__mMcgG {\n width: 52px;\n height: 28px;\n}\n\n/* The thumb */\n.Toggle-module_thumb__nibyJ {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n border-radius: 50%;\n background-color: #ffffff;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n transition: left 0.2s ease;\n}\n\n.Toggle-module_sm__JTqaB .Toggle-module_thumb__nibyJ {\n width: 14px;\n height: 14px;\n left: 2px;\n}\n\n.Toggle-module_md__QfS4K .Toggle-module_thumb__nibyJ {\n width: 18px;\n height: 18px;\n left: 2px;\n}\n\n.Toggle-module_lg__ajzsM .Toggle-module_thumb__nibyJ {\n width: 22px;\n height: 22px;\n left: 3px;\n}\n\n/* Checked state */\n.Toggle-module_checked__wOt93 .Toggle-module_track__mMcgG {\n background-color: var(--input-primary-color);\n}\n\n.Toggle-module_sm__JTqaB.Toggle-module_checked__wOt93 .Toggle-module_thumb__nibyJ {\n left: calc(32px - 14px - 2px);\n}\n\n.Toggle-module_md__QfS4K.Toggle-module_checked__wOt93 .Toggle-module_thumb__nibyJ {\n left: calc(40px - 18px - 2px);\n}\n\n.Toggle-module_lg__ajzsM.Toggle-module_checked__wOt93 .Toggle-module_thumb__nibyJ {\n left: calc(52px - 22px - 3px);\n}\n\n/* Focus */\n.Toggle-module_nativeInput__lSrsx:focus-visible + .Toggle-module_toggleRow__hjzZK .Toggle-module_track__mMcgG {\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);\n}\n\n/* Error state */\n.Toggle-module_error__9PzE1 .Toggle-module_track__mMcgG {\n outline: 2px solid var(--input-error-color);\n}\n\n.Toggle-module_label__gfTxr {\n font-size: 0.875rem;\n color: var(--input-text-color);\n line-height: 1.4;\n}\n\n.Toggle-module_sm__JTqaB .Toggle-module_label__gfTxr {\n font-size: 0.75rem;\n}\n\n.Toggle-module_lg__ajzsM .Toggle-module_label__gfTxr {\n font-size: 1rem;\n}\n\n.Toggle-module_helperText__YNB8v {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.Toggle-module_errorText__DHrSa {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n";
|
|
424
|
+
var styles$a = {"wrapper":"Toggle-module_wrapper__BDsrR","toggleRow":"Toggle-module_toggleRow__hjzZK","disabled":"Toggle-module_disabled__zqNfH","labelLeft":"Toggle-module_labelLeft__kifkm","nativeInput":"Toggle-module_nativeInput__lSrsx","track":"Toggle-module_track__mMcgG","sm":"Toggle-module_sm__JTqaB","md":"Toggle-module_md__QfS4K","lg":"Toggle-module_lg__ajzsM","thumb":"Toggle-module_thumb__nibyJ","checked":"Toggle-module_checked__wOt93","error":"Toggle-module_error__9PzE1","label":"Toggle-module_label__gfTxr","helperText":"Toggle-module_helperText__YNB8v","errorText":"Toggle-module_errorText__DHrSa"};
|
|
425
|
+
styleInject(css_248z$a);
|
|
426
|
+
|
|
427
|
+
const Toggle = forwardRef(({ size = 'md', validationState = 'default', label, helperText, errorMessage, required, disabled, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, checked, defaultChecked, onChange, labelPosition = 'right', ...rest }, ref) => {
|
|
428
|
+
const { inputId, helperId, inputAriaProps } = useFormField({
|
|
429
|
+
id,
|
|
430
|
+
helperText,
|
|
431
|
+
errorMessage,
|
|
432
|
+
validationState,
|
|
433
|
+
required,
|
|
434
|
+
disabled,
|
|
435
|
+
});
|
|
436
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : false);
|
|
437
|
+
const isControlled = checked !== undefined;
|
|
438
|
+
const isChecked = isControlled ? checked : internalChecked;
|
|
439
|
+
const handleChange = useCallback((e) => {
|
|
440
|
+
if (!isControlled) {
|
|
441
|
+
setInternalChecked(e.target.checked);
|
|
442
|
+
}
|
|
443
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
444
|
+
}, [isControlled, onChange]);
|
|
445
|
+
const activeMessage = validationState === 'error' ? errorMessage : helperText;
|
|
446
|
+
const messageClass = validationState === 'error' ? styles$a.errorText : styles$a.helperText;
|
|
447
|
+
return (jsxs("div", { className: classNames(styles$a.wrapper, styles$a[size], isChecked ? styles$a.checked : undefined, validationState === 'error' ? styles$a.error : undefined, wrapperClassName), style: wrapperStyle, children: [jsxs("label", { className: classNames(styles$a.toggleRow, labelPosition === 'left' ? styles$a.labelLeft : undefined, disabled ? styles$a.disabled : undefined), style: labelStyle, children: [jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "checkbox", role: "switch", disabled: disabled, required: required, checked: isChecked, onChange: handleChange, className: classNames(styles$a.nativeInput, inputClassName, className), style: inputStyle, "aria-checked": isChecked }), jsx("span", { className: styles$a.track, "aria-hidden": "true", children: jsx("span", { className: styles$a.thumb }) }), label && (jsx("span", { className: classNames(styles$a.label, required ? styles$a.required : undefined, labelClassName), children: label }))] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
448
|
+
});
|
|
449
|
+
Toggle.displayName = 'Toggle';
|
|
450
|
+
|
|
451
|
+
var css_248z$9 = ".DateInput-module_wrapper__gb-Sc {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.DateInput-module_fullWidth__SKTCn {\n width: 100%;\n}\n\n.DateInput-module_label__tPp1n {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.DateInput-module_required__-XUm4::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.DateInput-module_inputWrapper__1pthk {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.DateInput-module_input__YJOxe {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n}\n\n.DateInput-module_sm__o3ZGy .DateInput-module_input__YJOxe {\n padding: 6px 10px;\n font-size: 0.75rem;\n height: 32px;\n}\n\n.DateInput-module_md__WL3so .DateInput-module_input__YJOxe {\n padding: 8px 12px;\n font-size: 0.875rem;\n height: 40px;\n}\n\n.DateInput-module_lg__0SNFP .DateInput-module_input__YJOxe {\n padding: 10px 16px;\n font-size: 1rem;\n height: 48px;\n}\n\n.DateInput-module_outlined__lRSD0 .DateInput-module_input__YJOxe {\n border: 1px solid var(--input-border-color);\n}\n\n.DateInput-module_outlined__lRSD0 .DateInput-module_input__YJOxe:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.DateInput-module_outlined__lRSD0 .DateInput-module_input__YJOxe:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.DateInput-module_filled__tr8HZ .DateInput-module_input__YJOxe {\n border: 1px solid transparent;\n background-color: #f3f4f6;\n}\n\n.DateInput-module_filled__tr8HZ .DateInput-module_input__YJOxe:hover:not(:disabled) {\n background-color: #e5e7eb;\n}\n\n.DateInput-module_filled__tr8HZ .DateInput-module_input__YJOxe:focus {\n background-color: var(--input-bg-color);\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.DateInput-module_underlined__043p4 .DateInput-module_input__YJOxe {\n border: none;\n border-bottom: 2px solid var(--input-border-color);\n border-radius: 0;\n padding-left: 0;\n}\n\n.DateInput-module_underlined__043p4 .DateInput-module_input__YJOxe:hover:not(:disabled) {\n border-bottom-color: var(--input-primary-color);\n}\n\n.DateInput-module_underlined__043p4 .DateInput-module_input__YJOxe:focus {\n border-bottom-color: var(--input-primary-color);\n box-shadow: 0 2px 0 0 var(--input-focus-ring-color);\n}\n\n.DateInput-module_error__E7Fsi .DateInput-module_input__YJOxe {\n border-color: var(--input-error-color) !important;\n}\n\n.DateInput-module_error__E7Fsi .DateInput-module_input__YJOxe:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;\n}\n\n.DateInput-module_success__6YfwD .DateInput-module_input__YJOxe {\n border-color: var(--input-success-color) !important;\n}\n\n.DateInput-module_success__6YfwD .DateInput-module_input__YJOxe:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;\n}\n\n.DateInput-module_warning__-9La5 .DateInput-module_input__YJOxe {\n border-color: var(--input-warning-color) !important;\n}\n\n.DateInput-module_warning__-9La5 .DateInput-module_input__YJOxe:focus {\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;\n}\n\n.DateInput-module_input__YJOxe:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.DateInput-module_helperText__ti32b {\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.DateInput-module_errorText__HrTwK {\n font-size: 0.75rem;\n color: var(--input-error-color);\n}\n\n.DateInput-module_successText__9d9y2 {\n font-size: 0.75rem;\n color: var(--input-success-color);\n}\n\n.DateInput-module_warningText__Jr92E {\n font-size: 0.75rem;\n color: var(--input-warning-color);\n}\n";
|
|
452
|
+
var styles$9 = {"wrapper":"DateInput-module_wrapper__gb-Sc","fullWidth":"DateInput-module_fullWidth__SKTCn","label":"DateInput-module_label__tPp1n","required":"DateInput-module_required__-XUm4","inputWrapper":"DateInput-module_inputWrapper__1pthk","input":"DateInput-module_input__YJOxe","sm":"DateInput-module_sm__o3ZGy","md":"DateInput-module_md__WL3so","lg":"DateInput-module_lg__0SNFP","outlined":"DateInput-module_outlined__lRSD0","filled":"DateInput-module_filled__tr8HZ","underlined":"DateInput-module_underlined__043p4","error":"DateInput-module_error__E7Fsi","success":"DateInput-module_success__6YfwD","warning":"DateInput-module_warning__-9La5","helperText":"DateInput-module_helperText__ti32b","errorText":"DateInput-module_errorText__HrTwK","successText":"DateInput-module_successText__9d9y2","warningText":"DateInput-module_warningText__Jr92E"};
|
|
453
|
+
styleInject(css_248z$9);
|
|
454
|
+
|
|
455
|
+
const DateInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, min, max, ...rest }, ref) => {
|
|
456
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
457
|
+
id,
|
|
458
|
+
helperText,
|
|
459
|
+
errorMessage,
|
|
460
|
+
validationState,
|
|
461
|
+
required,
|
|
462
|
+
disabled,
|
|
463
|
+
});
|
|
464
|
+
const activeMessage = validationState === 'error'
|
|
465
|
+
? errorMessage
|
|
466
|
+
: validationState === 'success'
|
|
467
|
+
? successMessage
|
|
468
|
+
: validationState === 'warning'
|
|
469
|
+
? warningMessage
|
|
470
|
+
: helperText;
|
|
471
|
+
const messageClass = validationState === 'error'
|
|
472
|
+
? styles$9.errorText
|
|
473
|
+
: validationState === 'success'
|
|
474
|
+
? styles$9.successText
|
|
475
|
+
: validationState === 'warning'
|
|
476
|
+
? styles$9.warningText
|
|
477
|
+
: styles$9.helperText;
|
|
478
|
+
return (jsxs("div", { className: classNames(styles$9.wrapper, styles$9[size], styles$9[variant], validationState !== 'default' ? styles$9[validationState] : undefined, fullWidth ? styles$9.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$9.label, required ? styles$9.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: styles$9.inputWrapper, children: jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "date", disabled: disabled, readOnly: readOnly, required: required, min: min, max: max, className: classNames(styles$9.input, inputClassName, className), style: inputStyle }) }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
479
|
+
});
|
|
480
|
+
DateInput.displayName = 'DateInput';
|
|
481
|
+
|
|
482
|
+
var css_248z$8 = ".TimeInput-module_wrapper__MCOm5 {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.TimeInput-module_fullWidth__lpC7A { width: 100%; }\n\n.TimeInput-module_label__sAZQ3 {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.TimeInput-module_required__DCIFs::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.TimeInput-module_inputWrapper__ZJCl4 {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.TimeInput-module_input__SCl1Y {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n}\n\n.TimeInput-module_sm__WI89h .TimeInput-module_input__SCl1Y { padding: 6px 10px; font-size: 0.75rem; height: 32px; }\n.TimeInput-module_md__OHCbV .TimeInput-module_input__SCl1Y { padding: 8px 12px; font-size: 0.875rem; height: 40px; }\n.TimeInput-module_lg__049J0 .TimeInput-module_input__SCl1Y { padding: 10px 16px; font-size: 1rem; height: 48px; }\n\n.TimeInput-module_outlined__Lgmjn .TimeInput-module_input__SCl1Y { border: 1px solid var(--input-border-color); }\n.TimeInput-module_outlined__Lgmjn .TimeInput-module_input__SCl1Y:hover:not(:disabled) { border-color: var(--input-primary-color); }\n.TimeInput-module_outlined__Lgmjn .TimeInput-module_input__SCl1Y:focus { border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.TimeInput-module_filled__bidEU .TimeInput-module_input__SCl1Y { border: 1px solid transparent; background-color: #f3f4f6; }\n.TimeInput-module_filled__bidEU .TimeInput-module_input__SCl1Y:hover:not(:disabled) { background-color: #e5e7eb; }\n.TimeInput-module_filled__bidEU .TimeInput-module_input__SCl1Y:focus { background-color: var(--input-bg-color); border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.TimeInput-module_underlined__lk2qU .TimeInput-module_input__SCl1Y { border: none; border-bottom: 2px solid var(--input-border-color); border-radius: 0; padding-left: 0; }\n.TimeInput-module_underlined__lk2qU .TimeInput-module_input__SCl1Y:hover:not(:disabled) { border-bottom-color: var(--input-primary-color); }\n.TimeInput-module_underlined__lk2qU .TimeInput-module_input__SCl1Y:focus { border-bottom-color: var(--input-primary-color); box-shadow: 0 2px 0 0 var(--input-focus-ring-color); }\n\n.TimeInput-module_error__m9Y23 .TimeInput-module_input__SCl1Y { border-color: var(--input-error-color) !important; }\n.TimeInput-module_error__m9Y23 .TimeInput-module_input__SCl1Y:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important; }\n.TimeInput-module_success__Wq--r .TimeInput-module_input__SCl1Y { border-color: var(--input-success-color) !important; }\n.TimeInput-module_success__Wq--r .TimeInput-module_input__SCl1Y:focus { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important; }\n.TimeInput-module_warning__cwJ1N .TimeInput-module_input__SCl1Y { border-color: var(--input-warning-color) !important; }\n.TimeInput-module_warning__cwJ1N .TimeInput-module_input__SCl1Y:focus { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important; }\n\n.TimeInput-module_input__SCl1Y:disabled { background-color: var(--input-disabled-bg); color: var(--input-disabled-text); cursor: not-allowed; }\n\n.TimeInput-module_helperText__3oL9r { font-size: 0.75rem; color: #6b7280; }\n.TimeInput-module_errorText__pPqKU { font-size: 0.75rem; color: var(--input-error-color); }\n.TimeInput-module_successText__e1oON { font-size: 0.75rem; color: var(--input-success-color); }\n.TimeInput-module_warningText__rKU22 { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
483
|
+
var styles$8 = {"wrapper":"TimeInput-module_wrapper__MCOm5","fullWidth":"TimeInput-module_fullWidth__lpC7A","label":"TimeInput-module_label__sAZQ3","required":"TimeInput-module_required__DCIFs","inputWrapper":"TimeInput-module_inputWrapper__ZJCl4","input":"TimeInput-module_input__SCl1Y","sm":"TimeInput-module_sm__WI89h","md":"TimeInput-module_md__OHCbV","lg":"TimeInput-module_lg__049J0","outlined":"TimeInput-module_outlined__Lgmjn","filled":"TimeInput-module_filled__bidEU","underlined":"TimeInput-module_underlined__lk2qU","error":"TimeInput-module_error__m9Y23","success":"TimeInput-module_success__Wq--r","warning":"TimeInput-module_warning__cwJ1N","helperText":"TimeInput-module_helperText__3oL9r","errorText":"TimeInput-module_errorText__pPqKU","successText":"TimeInput-module_successText__e1oON","warningText":"TimeInput-module_warningText__rKU22"};
|
|
484
|
+
styleInject(css_248z$8);
|
|
485
|
+
|
|
486
|
+
const TimeInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, min, max, ...rest }, ref) => {
|
|
487
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
488
|
+
id,
|
|
489
|
+
helperText,
|
|
490
|
+
errorMessage,
|
|
491
|
+
validationState,
|
|
492
|
+
required,
|
|
493
|
+
disabled,
|
|
494
|
+
});
|
|
495
|
+
const activeMessage = validationState === 'error'
|
|
496
|
+
? errorMessage
|
|
497
|
+
: validationState === 'success'
|
|
498
|
+
? successMessage
|
|
499
|
+
: validationState === 'warning'
|
|
500
|
+
? warningMessage
|
|
501
|
+
: helperText;
|
|
502
|
+
const messageClass = validationState === 'error'
|
|
503
|
+
? styles$8.errorText
|
|
504
|
+
: validationState === 'success'
|
|
505
|
+
? styles$8.successText
|
|
506
|
+
: validationState === 'warning'
|
|
507
|
+
? styles$8.warningText
|
|
508
|
+
: styles$8.helperText;
|
|
509
|
+
return (jsxs("div", { className: classNames(styles$8.wrapper, styles$8[size], styles$8[variant], validationState !== 'default' ? styles$8[validationState] : undefined, fullWidth ? styles$8.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$8.label, required ? styles$8.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: styles$8.inputWrapper, children: jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "time", disabled: disabled, readOnly: readOnly, required: required, min: min, max: max, className: classNames(styles$8.input, inputClassName, className), style: inputStyle }) }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
510
|
+
});
|
|
511
|
+
TimeInput.displayName = 'TimeInput';
|
|
512
|
+
|
|
513
|
+
var css_248z$7 = ".FileInput-module_wrapper__hyUy4 {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.FileInput-module_fullWidth__fn0EN { width: 100%; }\n\n.FileInput-module_label__hDf85 {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.FileInput-module_required__ZZjss::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n/* Hidden native input */\n.FileInput-module_nativeInput__klmhh {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n/* Default file button trigger */\n.FileInput-module_fileButton__75R-4 {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 8px 16px;\n border: 1px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n background-color: var(--input-bg-color);\n color: var(--input-text-color);\n font-family: var(--input-font-family);\n font-size: 0.875rem;\n cursor: pointer;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n width: 100%;\n justify-content: center;\n}\n\n.FileInput-module_fileButton__75R-4:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n background-color: #f0f9ff;\n}\n\n.FileInput-module_fileButton__75R-4:focus-visible {\n outline: none;\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);\n}\n\n.FileInput-module_fileButton__75R-4:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.FileInput-module_sm__cGKgA .FileInput-module_fileButton__75R-4 { padding: 6px 12px; font-size: 0.75rem; }\n.FileInput-module_lg__1Cgy8 .FileInput-module_fileButton__75R-4 { padding: 10px 20px; font-size: 1rem; }\n\n/* Dropzone */\n.FileInput-module_dropzone__-pJmr {\n border: 2px dashed var(--input-border-color);\n border-radius: var(--input-border-radius);\n padding: 24px 16px;\n text-align: center;\n cursor: pointer;\n transition: border-color 0.15s ease, background-color 0.15s ease;\n background-color: var(--input-bg-color);\n color: var(--input-text-color);\n font-size: 0.875rem;\n}\n\n.FileInput-module_dropzone__-pJmr:hover:not(.FileInput-module_dropzoneDisabled__qF45l) {\n border-color: var(--input-primary-color);\n background-color: #f0f9ff;\n}\n\n.FileInput-module_dropzoneActive__Mn2IV {\n border-color: var(--input-primary-color);\n background-color: #eff6ff;\n}\n\n.FileInput-module_dropzoneDisabled__qF45l {\n background-color: var(--input-disabled-bg);\n cursor: not-allowed;\n color: var(--input-disabled-text);\n}\n\n.FileInput-module_dropzoneHint__Po1bF {\n font-size: 0.75rem;\n color: #6b7280;\n margin-top: 4px;\n}\n\n.FileInput-module_error__ZT6sh .FileInput-module_fileButton__75R-4,\n.FileInput-module_error__ZT6sh .FileInput-module_dropzone__-pJmr {\n border-color: var(--input-error-color);\n}\n\n.FileInput-module_fileNames__SREPS {\n margin-top: 4px;\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.FileInput-module_fileName__5RBXD {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.FileInput-module_helperText__a-3N7 { font-size: 0.75rem; color: #6b7280; }\n.FileInput-module_errorText__Axxn6 { font-size: 0.75rem; color: var(--input-error-color); }\n.FileInput-module_successText__caweh { font-size: 0.75rem; color: var(--input-success-color); }\n.FileInput-module_warningText__X6mA6 { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
514
|
+
var styles$7 = {"wrapper":"FileInput-module_wrapper__hyUy4","fullWidth":"FileInput-module_fullWidth__fn0EN","label":"FileInput-module_label__hDf85","required":"FileInput-module_required__ZZjss","nativeInput":"FileInput-module_nativeInput__klmhh","fileButton":"FileInput-module_fileButton__75R-4","sm":"FileInput-module_sm__cGKgA","lg":"FileInput-module_lg__1Cgy8","dropzone":"FileInput-module_dropzone__-pJmr","dropzoneDisabled":"FileInput-module_dropzoneDisabled__qF45l","dropzoneActive":"FileInput-module_dropzoneActive__Mn2IV","dropzoneHint":"FileInput-module_dropzoneHint__Po1bF","error":"FileInput-module_error__ZT6sh","fileNames":"FileInput-module_fileNames__SREPS","fileName":"FileInput-module_fileName__5RBXD","helperText":"FileInput-module_helperText__a-3N7","errorText":"FileInput-module_errorText__Axxn6","successText":"FileInput-module_successText__caweh","warningText":"FileInput-module_warningText__X6mA6"};
|
|
515
|
+
styleInject(css_248z$7);
|
|
516
|
+
|
|
517
|
+
const FileInput = forwardRef(({ size = 'md', variant: _variant, validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly: _readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, buttonLabel = 'Choose file', showFileNames = true, dropzone, onChange, multiple, accept, ...rest }, ref) => {
|
|
518
|
+
var _a;
|
|
519
|
+
const internalRef = useRef(null);
|
|
520
|
+
const fileRef = (_a = ref) !== null && _a !== void 0 ? _a : internalRef;
|
|
521
|
+
const [fileNames, setFileNames] = useState([]);
|
|
522
|
+
const [isDragActive, setIsDragActive] = useState(false);
|
|
523
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
524
|
+
id,
|
|
525
|
+
helperText,
|
|
526
|
+
errorMessage,
|
|
527
|
+
validationState,
|
|
528
|
+
required,
|
|
529
|
+
disabled,
|
|
530
|
+
});
|
|
531
|
+
const handleChange = useCallback((e) => {
|
|
532
|
+
const files = e.target.files;
|
|
533
|
+
if (files && showFileNames) {
|
|
534
|
+
setFileNames(Array.from(files).map((f) => f.name));
|
|
535
|
+
}
|
|
536
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
537
|
+
}, [onChange, showFileNames]);
|
|
538
|
+
const handleDrop = useCallback((e) => {
|
|
539
|
+
e.preventDefault();
|
|
540
|
+
setIsDragActive(false);
|
|
541
|
+
if (disabled || !fileRef.current)
|
|
542
|
+
return;
|
|
543
|
+
const dt = e.dataTransfer;
|
|
544
|
+
const files = dt.files;
|
|
545
|
+
if (files && showFileNames) {
|
|
546
|
+
setFileNames(Array.from(files).map((f) => f.name));
|
|
547
|
+
}
|
|
548
|
+
// Create synthetic change event
|
|
549
|
+
const changeEvent = { target: { files } };
|
|
550
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(changeEvent);
|
|
551
|
+
}, [disabled, fileRef, onChange, showFileNames]);
|
|
552
|
+
const activeMessage = getValidationMessage(validationState, errorMessage, successMessage, warningMessage, helperText);
|
|
553
|
+
const messageClass = getValidationMessageClass(validationState, styles$7);
|
|
554
|
+
return (jsxs("div", { className: classNames(styles$7.wrapper, styles$7[size], validationState === 'error' ? styles$7.error : undefined, fullWidth ? styles$7.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$7.label, required ? styles$7.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("input", { ...rest, ...inputAriaProps, ref: fileRef, id: inputId, type: "file", disabled: disabled, required: required, multiple: multiple, accept: accept, onChange: handleChange, className: classNames(styles$7.nativeInput, inputClassName, className), style: inputStyle }), dropzone ? (jsxs("div", { role: "button", tabIndex: disabled ? -1 : 0, "aria-label": buttonLabel, "aria-disabled": disabled, className: classNames(styles$7.dropzone, isDragActive ? styles$7.dropzoneActive : undefined, disabled ? styles$7.dropzoneDisabled : undefined), onClick: () => { var _a; return !disabled && ((_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click()); }, onKeyDown: (e) => {
|
|
555
|
+
var _a;
|
|
556
|
+
if (!disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
557
|
+
e.preventDefault();
|
|
558
|
+
(_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
559
|
+
}
|
|
560
|
+
}, onDragOver: (e) => { e.preventDefault(); if (!disabled)
|
|
561
|
+
setIsDragActive(true); }, onDragLeave: () => setIsDragActive(false), onDrop: handleDrop, children: [jsxs("div", { children: ["\uD83D\uDCC1 ", buttonLabel] }), jsx("p", { className: styles$7.dropzoneHint, children: "or drag and drop files here" })] })) : (jsxs("button", { type: "button", className: styles$7.fileButton, disabled: disabled, onClick: () => { var _a; return (_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, "aria-controls": inputId, children: ["\uD83D\uDCC1 ", buttonLabel] })), showFileNames && fileNames.length > 0 && (jsx("div", { className: styles$7.fileNames, children: fileNames.map((name) => (jsxs("div", { className: styles$7.fileName, children: ["\uD83D\uDCC4 ", name] }, name))) })), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
562
|
+
});
|
|
563
|
+
FileInput.displayName = 'FileInput';
|
|
564
|
+
|
|
565
|
+
var css_248z$6 = ".RangeInput-module_wrapper__ulryd {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-text-color: #111827;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 6px;\n font-family: var(--input-font-family);\n}\n\n.RangeInput-module_fullWidth__zBY4h { width: 100%; }\n\n.RangeInput-module_label__-gTdX {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.RangeInput-module_required__S74-H::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.RangeInput-module_rangeRow__S-3Jj {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.RangeInput-module_input__R7g-4 {\n flex: 1;\n -webkit-appearance: none;\n appearance: none;\n height: 4px;\n border-radius: 2px;\n background: var(--input-border-color);\n outline: none;\n cursor: pointer;\n accent-color: var(--input-primary-color);\n}\n\n.RangeInput-module_sm__TU2Ae .RangeInput-module_input__R7g-4 { height: 2px; }\n.RangeInput-module_lg__lBSD8 .RangeInput-module_input__R7g-4 { height: 6px; }\n\n.RangeInput-module_input__R7g-4::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--input-primary-color);\n cursor: pointer;\n transition: box-shadow 0.15s ease;\n}\n\n.RangeInput-module_sm__TU2Ae .RangeInput-module_input__R7g-4::-webkit-slider-thumb { width: 14px; height: 14px; }\n.RangeInput-module_lg__lBSD8 .RangeInput-module_input__R7g-4::-webkit-slider-thumb { width: 22px; height: 22px; }\n\n.RangeInput-module_input__R7g-4::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--input-primary-color);\n cursor: pointer;\n border: none;\n}\n\n.RangeInput-module_input__R7g-4:focus-visible::-webkit-slider-thumb {\n box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4);\n}\n\n.RangeInput-module_input__R7g-4:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.RangeInput-module_error__KD74b .RangeInput-module_input__R7g-4 { accent-color: var(--input-error-color); }\n.RangeInput-module_success__5qCxe .RangeInput-module_input__R7g-4 { accent-color: var(--input-success-color); }\n.RangeInput-module_warning__Y2lJr .RangeInput-module_input__R7g-4 { accent-color: var(--input-warning-color); }\n\n.RangeInput-module_valueDisplay__bEJfU {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n min-width: 40px;\n text-align: right;\n white-space: nowrap;\n}\n\n.RangeInput-module_sm__TU2Ae .RangeInput-module_valueDisplay__bEJfU { font-size: 0.75rem; min-width: 32px; }\n.RangeInput-module_lg__lBSD8 .RangeInput-module_valueDisplay__bEJfU { font-size: 1rem; min-width: 48px; }\n\n.RangeInput-module_rangeFooter__H0fdW {\n display: flex;\n justify-content: space-between;\n font-size: 0.75rem;\n color: #9ca3af;\n}\n\n.RangeInput-module_helperText__nTZre { font-size: 0.75rem; color: #6b7280; }\n.RangeInput-module_errorText__--65V { font-size: 0.75rem; color: var(--input-error-color); }\n.RangeInput-module_successText__80mA- { font-size: 0.75rem; color: var(--input-success-color); }\n.RangeInput-module_warningText__UGKM5 { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
566
|
+
var styles$6 = {"wrapper":"RangeInput-module_wrapper__ulryd","fullWidth":"RangeInput-module_fullWidth__zBY4h","label":"RangeInput-module_label__-gTdX","required":"RangeInput-module_required__S74-H","rangeRow":"RangeInput-module_rangeRow__S-3Jj","input":"RangeInput-module_input__R7g-4","sm":"RangeInput-module_sm__TU2Ae","lg":"RangeInput-module_lg__lBSD8","error":"RangeInput-module_error__KD74b","success":"RangeInput-module_success__5qCxe","warning":"RangeInput-module_warning__Y2lJr","valueDisplay":"RangeInput-module_valueDisplay__bEJfU","rangeFooter":"RangeInput-module_rangeFooter__H0fdW","helperText":"RangeInput-module_helperText__nTZre","errorText":"RangeInput-module_errorText__--65V","successText":"RangeInput-module_successText__80mA-","warningText":"RangeInput-module_warningText__UGKM5"};
|
|
567
|
+
styleInject(css_248z$6);
|
|
568
|
+
|
|
569
|
+
const RangeInput = forwardRef(({ size = 'md', variant: _variant, validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly: _readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, min = 0, max = 100, step = 1, showValue, formatValue, value, defaultValue, onChange, ...rest }, ref) => {
|
|
570
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
571
|
+
id,
|
|
572
|
+
helperText,
|
|
573
|
+
errorMessage,
|
|
574
|
+
validationState,
|
|
575
|
+
required,
|
|
576
|
+
disabled,
|
|
577
|
+
});
|
|
578
|
+
const getInitial = () => {
|
|
579
|
+
if (value !== undefined)
|
|
580
|
+
return Number(value);
|
|
581
|
+
if (defaultValue !== undefined)
|
|
582
|
+
return Number(defaultValue);
|
|
583
|
+
return (Number(min) + Number(max)) / 2;
|
|
584
|
+
};
|
|
585
|
+
const [internalValue, setInternalValue] = useState(getInitial);
|
|
586
|
+
const isControlled = value !== undefined;
|
|
587
|
+
const currentValue = isControlled ? Number(value) : internalValue;
|
|
588
|
+
const handleChange = useCallback((e) => {
|
|
589
|
+
const numVal = parseFloat(e.target.value);
|
|
590
|
+
if (!isControlled) {
|
|
591
|
+
setInternalValue(numVal);
|
|
592
|
+
}
|
|
593
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
594
|
+
}, [isControlled, onChange]);
|
|
595
|
+
const displayValue = formatValue ? formatValue(currentValue) : String(currentValue);
|
|
596
|
+
const activeMessage = validationState === 'error'
|
|
597
|
+
? errorMessage
|
|
598
|
+
: validationState === 'success'
|
|
599
|
+
? successMessage
|
|
600
|
+
: validationState === 'warning'
|
|
601
|
+
? warningMessage
|
|
602
|
+
: helperText;
|
|
603
|
+
const messageClass = validationState === 'error'
|
|
604
|
+
? styles$6.errorText
|
|
605
|
+
: validationState === 'success'
|
|
606
|
+
? styles$6.successText
|
|
607
|
+
: validationState === 'warning'
|
|
608
|
+
? styles$6.warningText
|
|
609
|
+
: styles$6.helperText;
|
|
610
|
+
return (jsxs("div", { className: classNames(styles$6.wrapper, styles$6[size], validationState !== 'default' ? styles$6[validationState] : undefined, fullWidth ? styles$6.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$6.label, required ? styles$6.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$6.rangeRow, children: [jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "range", disabled: disabled, required: required, min: min, max: max, step: step, value: currentValue, onChange: handleChange, className: classNames(styles$6.input, inputClassName, className), style: inputStyle }), showValue && (jsx("span", { className: styles$6.valueDisplay, children: displayValue }))] }), jsxs("div", { className: styles$6.rangeFooter, children: [jsx("span", { children: min }), jsx("span", { children: max })] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
611
|
+
});
|
|
612
|
+
RangeInput.displayName = 'RangeInput';
|
|
613
|
+
|
|
614
|
+
var css_248z$5 = ".ColorInput-module_wrapper__qUnwO {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.ColorInput-module_fullWidth__hh3zh { width: 100%; }\n\n.ColorInput-module_label__IqBt0 {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.ColorInput-module_required__sxFlJ::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.ColorInput-module_colorRow__ohcMv {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.ColorInput-module_colorSwatch__w3O57 {\n position: relative;\n flex-shrink: 0;\n width: 40px;\n height: 40px;\n border-radius: var(--input-border-radius);\n border: 1px solid var(--input-border-color);\n overflow: hidden;\n cursor: pointer;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n\n.ColorInput-module_sm__0382y .ColorInput-module_colorSwatch__w3O57 { width: 32px; height: 32px; }\n.ColorInput-module_lg__o-y7B .ColorInput-module_colorSwatch__w3O57 { width: 48px; height: 48px; }\n\n.ColorInput-module_colorSwatch__w3O57:hover:not(.ColorInput-module_disabledSwatch__Z4jau) {\n border-color: var(--input-primary-color);\n}\n\n.ColorInput-module_colorSwatch__w3O57:focus-within {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);\n}\n\n.ColorInput-module_disabledSwatch__Z4jau {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.ColorInput-module_error__f3QfI .ColorInput-module_colorSwatch__w3O57 {\n border-color: var(--input-error-color);\n}\n\n.ColorInput-module_input__j9Fzh {\n position: absolute;\n top: 0;\n left: 0;\n width: 200%;\n height: 200%;\n transform: translate(-25%, -25%);\n cursor: pointer;\n border: none;\n padding: 0;\n background: none;\n opacity: 0.01;\n}\n\n.ColorInput-module_input__j9Fzh:disabled {\n cursor: not-allowed;\n}\n\n.ColorInput-module_hexValue__2c1oZ {\n font-size: 0.875rem;\n font-family: monospace;\n color: var(--input-text-color);\n padding: 6px 10px;\n border: 1px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n background-color: var(--input-bg-color);\n min-width: 90px;\n}\n\n.ColorInput-module_sm__0382y .ColorInput-module_hexValue__2c1oZ { font-size: 0.75rem; padding: 4px 8px; min-width: 80px; }\n.ColorInput-module_lg__o-y7B .ColorInput-module_hexValue__2c1oZ { font-size: 1rem; padding: 8px 12px; min-width: 100px; }\n\n.ColorInput-module_helperText__1cY-b { font-size: 0.75rem; color: #6b7280; }\n.ColorInput-module_errorText__9qkSK { font-size: 0.75rem; color: var(--input-error-color); }\n.ColorInput-module_successText__Fgf5d { font-size: 0.75rem; color: var(--input-success-color); }\n.ColorInput-module_warningText__xYykx { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
615
|
+
var styles$5 = {"wrapper":"ColorInput-module_wrapper__qUnwO","fullWidth":"ColorInput-module_fullWidth__hh3zh","label":"ColorInput-module_label__IqBt0","required":"ColorInput-module_required__sxFlJ","colorRow":"ColorInput-module_colorRow__ohcMv","colorSwatch":"ColorInput-module_colorSwatch__w3O57","sm":"ColorInput-module_sm__0382y","lg":"ColorInput-module_lg__o-y7B","disabledSwatch":"ColorInput-module_disabledSwatch__Z4jau","error":"ColorInput-module_error__f3QfI","input":"ColorInput-module_input__j9Fzh","hexValue":"ColorInput-module_hexValue__2c1oZ","helperText":"ColorInput-module_helperText__1cY-b","errorText":"ColorInput-module_errorText__9qkSK","successText":"ColorInput-module_successText__Fgf5d","warningText":"ColorInput-module_warningText__xYykx"};
|
|
616
|
+
styleInject(css_248z$5);
|
|
617
|
+
|
|
618
|
+
const ColorInput = forwardRef(({ size = 'md', variant: _variant, validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly: _readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, showHexValue = true, value, defaultValue, onChange, ...rest }, ref) => {
|
|
619
|
+
var _a;
|
|
620
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
621
|
+
id,
|
|
622
|
+
helperText,
|
|
623
|
+
errorMessage,
|
|
624
|
+
validationState,
|
|
625
|
+
required,
|
|
626
|
+
disabled,
|
|
627
|
+
});
|
|
628
|
+
const [internalColor, setInternalColor] = useState((_a = defaultValue) !== null && _a !== void 0 ? _a : '#3b82f6');
|
|
629
|
+
const isControlled = value !== undefined;
|
|
630
|
+
const currentColor = isControlled ? value : internalColor;
|
|
631
|
+
const handleChange = useCallback((e) => {
|
|
632
|
+
if (!isControlled) {
|
|
633
|
+
setInternalColor(e.target.value);
|
|
634
|
+
}
|
|
635
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
636
|
+
}, [isControlled, onChange]);
|
|
637
|
+
const activeMessage = validationState === 'error'
|
|
638
|
+
? errorMessage
|
|
639
|
+
: validationState === 'success'
|
|
640
|
+
? successMessage
|
|
641
|
+
: validationState === 'warning'
|
|
642
|
+
? warningMessage
|
|
643
|
+
: helperText;
|
|
644
|
+
const messageClass = validationState === 'error'
|
|
645
|
+
? styles$5.errorText
|
|
646
|
+
: validationState === 'success'
|
|
647
|
+
? styles$5.successText
|
|
648
|
+
: validationState === 'warning'
|
|
649
|
+
? styles$5.warningText
|
|
650
|
+
: styles$5.helperText;
|
|
651
|
+
return (jsxs("div", { className: classNames(styles$5.wrapper, styles$5[size], validationState === 'error' ? styles$5.error : undefined, fullWidth ? styles$5.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$5.label, required ? styles$5.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$5.colorRow, children: [jsx("div", { className: classNames(styles$5.colorSwatch, disabled ? styles$5.disabledSwatch : undefined), style: { backgroundColor: currentColor }, children: jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "color", disabled: disabled, required: required, value: currentColor, onChange: handleChange, className: classNames(styles$5.input, inputClassName, className), style: inputStyle }) }), showHexValue && (jsx("span", { className: styles$5.hexValue, children: currentColor.toUpperCase() }))] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
652
|
+
});
|
|
653
|
+
ColorInput.displayName = 'ColorInput';
|
|
654
|
+
|
|
655
|
+
var css_248z$4 = ".SearchInput-module_wrapper__q8GEq {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 9999px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.SearchInput-module_fullWidth__AFi3K { width: 100%; }\n\n.SearchInput-module_label__4lcBT {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.SearchInput-module_required__Bf3HX::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.SearchInput-module_inputWrapper__8rYVN {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.SearchInput-module_input__rhhzi {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n}\n\n.SearchInput-module_input__rhhzi::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.SearchInput-module_sm__duydm .SearchInput-module_input__rhhzi { padding: 6px 32px 6px 32px; font-size: 0.75rem; height: 32px; }\n.SearchInput-module_md__6Z2o0 .SearchInput-module_input__rhhzi { padding: 8px 36px 8px 36px; font-size: 0.875rem; height: 40px; }\n.SearchInput-module_lg__tTVz- .SearchInput-module_input__rhhzi { padding: 10px 44px 10px 44px; font-size: 1rem; height: 48px; }\n\n.SearchInput-module_hasClear__T5LPA.SearchInput-module_sm__duydm .SearchInput-module_input__rhhzi { padding-right: 56px; }\n.SearchInput-module_hasClear__T5LPA.SearchInput-module_md__6Z2o0 .SearchInput-module_input__rhhzi { padding-right: 64px; }\n.SearchInput-module_hasClear__T5LPA.SearchInput-module_lg__tTVz- .SearchInput-module_input__rhhzi { padding-right: 72px; }\n\n.SearchInput-module_outlined__UjHm1 .SearchInput-module_input__rhhzi { border: 1px solid var(--input-border-color); }\n.SearchInput-module_outlined__UjHm1 .SearchInput-module_input__rhhzi:hover:not(:disabled) { border-color: var(--input-primary-color); }\n.SearchInput-module_outlined__UjHm1 .SearchInput-module_input__rhhzi:focus { border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.SearchInput-module_filled__A8jTf .SearchInput-module_input__rhhzi { border: 1px solid transparent; background-color: #f3f4f6; }\n.SearchInput-module_filled__A8jTf .SearchInput-module_input__rhhzi:hover:not(:disabled) { background-color: #e5e7eb; }\n.SearchInput-module_filled__A8jTf .SearchInput-module_input__rhhzi:focus { background-color: var(--input-bg-color); border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.SearchInput-module_underlined__AGfjj .SearchInput-module_input__rhhzi { border: none; border-bottom: 2px solid var(--input-border-color); border-radius: 0; }\n.SearchInput-module_underlined__AGfjj .SearchInput-module_input__rhhzi:hover:not(:disabled) { border-bottom-color: var(--input-primary-color); }\n.SearchInput-module_underlined__AGfjj .SearchInput-module_input__rhhzi:focus { border-bottom-color: var(--input-primary-color); box-shadow: 0 2px 0 0 var(--input-focus-ring-color); }\n\n.SearchInput-module_error__Ewib2 .SearchInput-module_input__rhhzi { border-color: var(--input-error-color) !important; }\n.SearchInput-module_error__Ewib2 .SearchInput-module_input__rhhzi:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important; }\n\n.SearchInput-module_input__rhhzi:disabled { background-color: var(--input-disabled-bg); color: var(--input-disabled-text); cursor: not-allowed; }\n\n.SearchInput-module_searchIcon__O0FTp {\n position: absolute;\n left: 10px;\n color: var(--input-placeholder-color);\n pointer-events: none;\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n\n.SearchInput-module_clearBtn__2cwc9 {\n position: absolute;\n right: 10px;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--input-placeholder-color);\n padding: 2px;\n display: flex;\n align-items: center;\n border-radius: 50%;\n transition: color 0.15s ease, background-color 0.15s ease;\n line-height: 1;\n font-size: 0.875rem;\n}\n\n.SearchInput-module_clearBtn__2cwc9:hover { color: var(--input-text-color); background-color: #f3f4f6; }\n.SearchInput-module_clearBtn__2cwc9:disabled { cursor: not-allowed; opacity: 0.5; }\n\n.SearchInput-module_helperText__pCOLe { font-size: 0.75rem; color: #6b7280; }\n.SearchInput-module_errorText__MbWFu { font-size: 0.75rem; color: var(--input-error-color); }\n.SearchInput-module_successText__LN6Yh { font-size: 0.75rem; color: var(--input-success-color); }\n.SearchInput-module_warningText__K07X1 { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
656
|
+
var styles$4 = {"wrapper":"SearchInput-module_wrapper__q8GEq","fullWidth":"SearchInput-module_fullWidth__AFi3K","label":"SearchInput-module_label__4lcBT","required":"SearchInput-module_required__Bf3HX","inputWrapper":"SearchInput-module_inputWrapper__8rYVN","input":"SearchInput-module_input__rhhzi","sm":"SearchInput-module_sm__duydm","md":"SearchInput-module_md__6Z2o0","lg":"SearchInput-module_lg__tTVz-","hasClear":"SearchInput-module_hasClear__T5LPA","outlined":"SearchInput-module_outlined__UjHm1","filled":"SearchInput-module_filled__A8jTf","underlined":"SearchInput-module_underlined__AGfjj","error":"SearchInput-module_error__Ewib2","searchIcon":"SearchInput-module_searchIcon__O0FTp","clearBtn":"SearchInput-module_clearBtn__2cwc9","helperText":"SearchInput-module_helperText__pCOLe","errorText":"SearchInput-module_errorText__MbWFu","successText":"SearchInput-module_successText__LN6Yh","warningText":"SearchInput-module_warningText__K07X1"};
|
|
657
|
+
styleInject(css_248z$4);
|
|
658
|
+
|
|
659
|
+
const SearchInput = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, onSearch, showClearButton = true, showSearchIcon = true, value, defaultValue, onChange, onKeyDown, placeholder = 'Search…', ...rest }, ref) => {
|
|
660
|
+
var _a, _b;
|
|
661
|
+
const internalRef = useRef(null);
|
|
662
|
+
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : internalRef;
|
|
663
|
+
const [internalValue, setInternalValue] = useState((_b = defaultValue) !== null && _b !== void 0 ? _b : '');
|
|
664
|
+
const isControlled = value !== undefined;
|
|
665
|
+
const currentValue = isControlled ? value : internalValue;
|
|
666
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
667
|
+
id,
|
|
668
|
+
helperText,
|
|
669
|
+
errorMessage,
|
|
670
|
+
validationState,
|
|
671
|
+
required,
|
|
672
|
+
disabled,
|
|
673
|
+
});
|
|
674
|
+
const handleChange = useCallback((e) => {
|
|
675
|
+
if (!isControlled)
|
|
676
|
+
setInternalValue(e.target.value);
|
|
677
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
678
|
+
}, [isControlled, onChange]);
|
|
679
|
+
const handleKeyDown = useCallback((e) => {
|
|
680
|
+
if (e.key === 'Enter') {
|
|
681
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(currentValue);
|
|
682
|
+
}
|
|
683
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
684
|
+
}, [currentValue, onSearch, onKeyDown]);
|
|
685
|
+
const handleClear = useCallback(() => {
|
|
686
|
+
var _a;
|
|
687
|
+
if (!isControlled)
|
|
688
|
+
setInternalValue('');
|
|
689
|
+
// Call onChange with a synthetic event if the component is controlled
|
|
690
|
+
if (onChange && inputRef.current) {
|
|
691
|
+
const syntheticEvent = {
|
|
692
|
+
target: { ...inputRef.current, value: '' },
|
|
693
|
+
currentTarget: inputRef.current,
|
|
694
|
+
};
|
|
695
|
+
onChange(syntheticEvent);
|
|
696
|
+
}
|
|
697
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch('');
|
|
698
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
699
|
+
}, [isControlled, inputRef, onChange, onSearch]);
|
|
700
|
+
const activeMessage = getValidationMessage(validationState, errorMessage, successMessage, warningMessage, helperText);
|
|
701
|
+
const messageClass = getValidationMessageClass(validationState, styles$4);
|
|
702
|
+
const hasClearButton = showClearButton && Boolean(currentValue);
|
|
703
|
+
return (jsxs("div", { className: classNames(styles$4.wrapper, styles$4[size], styles$4[variant], validationState !== 'default' ? styles$4[validationState] : undefined, fullWidth ? styles$4.fullWidth : undefined, hasClearButton ? styles$4.hasClear : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$4.label, required ? styles$4.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$4.inputWrapper, children: [showSearchIcon && jsx("span", { className: styles$4.searchIcon, children: "\uD83D\uDD0D" }), jsx("input", { ...rest, ...inputAriaProps, ref: inputRef, id: inputId, type: "search", disabled: disabled, readOnly: readOnly, required: required, placeholder: placeholder, value: currentValue, onChange: handleChange, onKeyDown: handleKeyDown, className: classNames(styles$4.input, inputClassName, className), style: inputStyle }), hasClearButton && (jsx("button", { type: "button", className: styles$4.clearBtn, onClick: handleClear, disabled: disabled, "aria-label": "Clear search", tabIndex: -1, children: "\u2715" }))] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
704
|
+
});
|
|
705
|
+
SearchInput.displayName = 'SearchInput';
|
|
706
|
+
|
|
707
|
+
var css_248z$3 = ".PhoneInput-module_wrapper__iOjQp {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n}\n\n.PhoneInput-module_fullWidth__9uKh2 { width: 100%; }\n\n.PhoneInput-module_label__UCCbp {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.PhoneInput-module_required__6VEPp::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.PhoneInput-module_inputWrapper__nBvRv {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n overflow: hidden;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n background-color: var(--input-bg-color);\n}\n\n.PhoneInput-module_inputWrapper__nBvRv:hover:not(.PhoneInput-module_disabledWrapper__u-AtZ) {\n border-color: var(--input-primary-color);\n}\n\n.PhoneInput-module_inputWrapper__nBvRv:focus-within:not(.PhoneInput-module_disabledWrapper__u-AtZ) {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.PhoneInput-module_error__GzzTI .PhoneInput-module_inputWrapper__nBvRv {\n border-color: var(--input-error-color);\n}\n\n.PhoneInput-module_error__GzzTI .PhoneInput-module_inputWrapper__nBvRv:focus-within {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);\n}\n\n.PhoneInput-module_success__z-7Ws .PhoneInput-module_inputWrapper__nBvRv {\n border-color: var(--input-success-color);\n}\n\n.PhoneInput-module_warning__aO217 .PhoneInput-module_inputWrapper__nBvRv {\n border-color: var(--input-warning-color);\n}\n\n.PhoneInput-module_disabledWrapper__u-AtZ {\n background-color: var(--input-disabled-bg);\n cursor: not-allowed;\n}\n\n.PhoneInput-module_dialCodeSelect__cA5WX {\n appearance: none;\n -webkit-appearance: none;\n background: none;\n border: none;\n border-right: 1px solid var(--input-border-color);\n outline: none;\n cursor: pointer;\n color: var(--input-text-color);\n font-family: var(--input-font-family);\n padding-right: 4px;\n}\n\n.PhoneInput-module_dialCodeSelect__cA5WX:disabled {\n cursor: not-allowed;\n color: var(--input-disabled-text);\n}\n\n.PhoneInput-module_sm__uuSpa .PhoneInput-module_dialCodeSelect__cA5WX { padding: 6px 8px; font-size: 0.75rem; }\n.PhoneInput-module_md__NldZt .PhoneInput-module_dialCodeSelect__cA5WX { padding: 8px 10px; font-size: 0.875rem; }\n.PhoneInput-module_lg__68zrK .PhoneInput-module_dialCodeSelect__cA5WX { padding: 10px 12px; font-size: 1rem; }\n\n.PhoneInput-module_phoneInput__3TeHi {\n flex: 1;\n border: none;\n outline: none;\n background: none;\n color: var(--input-text-color);\n font-family: var(--input-font-family);\n}\n\n.PhoneInput-module_phoneInput__3TeHi::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.PhoneInput-module_phoneInput__3TeHi:disabled {\n cursor: not-allowed;\n color: var(--input-disabled-text);\n}\n\n.PhoneInput-module_sm__uuSpa .PhoneInput-module_phoneInput__3TeHi { padding: 6px 10px; font-size: 0.75rem; }\n.PhoneInput-module_md__NldZt .PhoneInput-module_phoneInput__3TeHi { padding: 8px 12px; font-size: 0.875rem; }\n.PhoneInput-module_lg__68zrK .PhoneInput-module_phoneInput__3TeHi { padding: 10px 16px; font-size: 1rem; }\n\n.PhoneInput-module_helperText__liCEX { font-size: 0.75rem; color: #6b7280; }\n.PhoneInput-module_errorText__a64SR { font-size: 0.75rem; color: var(--input-error-color); }\n.PhoneInput-module_successText__1ncrR { font-size: 0.75rem; color: var(--input-success-color); }\n.PhoneInput-module_warningText__zbRzg { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
708
|
+
var styles$3 = {"wrapper":"PhoneInput-module_wrapper__iOjQp","fullWidth":"PhoneInput-module_fullWidth__9uKh2","label":"PhoneInput-module_label__UCCbp","required":"PhoneInput-module_required__6VEPp","inputWrapper":"PhoneInput-module_inputWrapper__nBvRv","disabledWrapper":"PhoneInput-module_disabledWrapper__u-AtZ","error":"PhoneInput-module_error__GzzTI","success":"PhoneInput-module_success__z-7Ws","warning":"PhoneInput-module_warning__aO217","dialCodeSelect":"PhoneInput-module_dialCodeSelect__cA5WX","sm":"PhoneInput-module_sm__uuSpa","md":"PhoneInput-module_md__NldZt","lg":"PhoneInput-module_lg__68zrK","phoneInput":"PhoneInput-module_phoneInput__3TeHi","helperText":"PhoneInput-module_helperText__liCEX","errorText":"PhoneInput-module_errorText__a64SR","successText":"PhoneInput-module_successText__1ncrR","warningText":"PhoneInput-module_warningText__zbRzg"};
|
|
709
|
+
styleInject(css_248z$3);
|
|
710
|
+
|
|
711
|
+
const DEFAULT_COUNTRIES = [
|
|
712
|
+
{ code: 'US', dialCode: '+1', flag: '🇺🇸', name: 'United States' },
|
|
713
|
+
{ code: 'GB', dialCode: '+44', flag: '🇬🇧', name: 'United Kingdom' },
|
|
714
|
+
{ code: 'CA', dialCode: '+1', flag: '🇨🇦', name: 'Canada' },
|
|
715
|
+
{ code: 'AU', dialCode: '+61', flag: '🇦🇺', name: 'Australia' },
|
|
716
|
+
{ code: 'DE', dialCode: '+49', flag: '🇩🇪', name: 'Germany' },
|
|
717
|
+
{ code: 'FR', dialCode: '+33', flag: '🇫🇷', name: 'France' },
|
|
718
|
+
{ code: 'IN', dialCode: '+91', flag: '🇮🇳', name: 'India' },
|
|
719
|
+
{ code: 'JP', dialCode: '+81', flag: '🇯🇵', name: 'Japan' },
|
|
720
|
+
{ code: 'CN', dialCode: '+86', flag: '🇨🇳', name: 'China' },
|
|
721
|
+
{ code: 'BR', dialCode: '+55', flag: '🇧🇷', name: 'Brazil' },
|
|
722
|
+
];
|
|
723
|
+
const PhoneInput = forwardRef(({ size = 'md', variant: _variant, validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, dialCode, defaultDialCode = '+1', countries = DEFAULT_COUNTRIES, onChange, phoneValue, placeholder = '(555) 000-0000', ...rest }, ref) => {
|
|
724
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
725
|
+
id,
|
|
726
|
+
helperText,
|
|
727
|
+
errorMessage,
|
|
728
|
+
validationState,
|
|
729
|
+
required,
|
|
730
|
+
disabled,
|
|
731
|
+
});
|
|
732
|
+
const [internalDial, setInternalDial] = useState(defaultDialCode);
|
|
733
|
+
const [internalPhone, setInternalPhone] = useState('');
|
|
734
|
+
const isDialControlled = dialCode !== undefined;
|
|
735
|
+
const isPhoneControlled = phoneValue !== undefined;
|
|
736
|
+
const currentDial = isDialControlled ? dialCode : internalDial;
|
|
737
|
+
const currentPhone = isPhoneControlled ? phoneValue : internalPhone;
|
|
738
|
+
const handleDialChange = useCallback((e) => {
|
|
739
|
+
const newDial = e.target.value;
|
|
740
|
+
if (!isDialControlled)
|
|
741
|
+
setInternalDial(newDial);
|
|
742
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(currentPhone, newDial);
|
|
743
|
+
}, [isDialControlled, currentPhone, onChange]);
|
|
744
|
+
const handlePhoneChange = useCallback((e) => {
|
|
745
|
+
const newPhone = e.target.value.replace(/[^\d\s\-().+]/g, '');
|
|
746
|
+
if (!isPhoneControlled)
|
|
747
|
+
setInternalPhone(newPhone);
|
|
748
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newPhone, currentDial);
|
|
749
|
+
}, [isPhoneControlled, currentDial, onChange]);
|
|
750
|
+
const activeMessage = validationState === 'error'
|
|
751
|
+
? errorMessage
|
|
752
|
+
: validationState === 'success'
|
|
753
|
+
? successMessage
|
|
754
|
+
: validationState === 'warning'
|
|
755
|
+
? warningMessage
|
|
756
|
+
: helperText;
|
|
757
|
+
const messageClass = validationState === 'error'
|
|
758
|
+
? styles$3.errorText
|
|
759
|
+
: validationState === 'success'
|
|
760
|
+
? styles$3.successText
|
|
761
|
+
: validationState === 'warning'
|
|
762
|
+
? styles$3.warningText
|
|
763
|
+
: styles$3.helperText;
|
|
764
|
+
return (jsxs("div", { className: classNames(styles$3.wrapper, styles$3[size], validationState !== 'default' ? styles$3[validationState] : undefined, fullWidth ? styles$3.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$3.label, required ? styles$3.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: classNames(styles$3.inputWrapper, disabled ? styles$3.disabledWrapper : undefined), children: [jsx("select", { className: styles$3.dialCodeSelect, value: currentDial, onChange: handleDialChange, disabled: disabled, "aria-label": "Country dial code", children: countries.map((c) => (jsxs("option", { value: c.dialCode, children: [c.flag, " ", c.dialCode] }, `${c.code}-${c.dialCode}`))) }), jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "tel", disabled: disabled, readOnly: readOnly, required: required, placeholder: placeholder, value: currentPhone, onChange: handlePhoneChange, className: classNames(styles$3.phoneInput, inputClassName, className), style: inputStyle })] }), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
765
|
+
});
|
|
766
|
+
PhoneInput.displayName = 'PhoneInput';
|
|
767
|
+
|
|
768
|
+
var css_248z$2 = ".OTPInput-module_wrapper__ylADf {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-border-radius: 8px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n font-family: var(--input-font-family);\n}\n\n.OTPInput-module_label__Z5sSZ {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.OTPInput-module_required__-26HV::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.OTPInput-module_inputsRow__xHAzs {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.OTPInput-module_separator__1rLQ5 {\n color: var(--input-text-color);\n font-weight: 600;\n user-select: none;\n}\n\n.OTPInput-module_digitInput__JmEt3 {\n width: 40px;\n height: 48px;\n text-align: center;\n font-size: 1.25rem;\n font-weight: 600;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border: 2px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n outline: none;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n caret-color: transparent;\n cursor: default;\n box-sizing: border-box;\n}\n\n.OTPInput-module_sm__OBISd .OTPInput-module_digitInput__JmEt3 { width: 32px; height: 38px; font-size: 1rem; }\n.OTPInput-module_lg__nv2s6 .OTPInput-module_digitInput__JmEt3 { width: 52px; height: 60px; font-size: 1.5rem; }\n\n.OTPInput-module_digitInput__JmEt3:hover:not(:disabled) {\n border-color: var(--input-primary-color);\n}\n\n.OTPInput-module_digitInput__JmEt3:focus {\n border-color: var(--input-primary-color);\n box-shadow: 0 0 0 3px var(--input-focus-ring-color);\n}\n\n.OTPInput-module_digitInput__JmEt3:disabled {\n background-color: var(--input-disabled-bg);\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.OTPInput-module_digitFilled__66FNT {\n border-color: var(--input-primary-color);\n}\n\n.OTPInput-module_error__bjKug .OTPInput-module_digitInput__JmEt3 {\n border-color: var(--input-error-color);\n}\n\n.OTPInput-module_error__bjKug .OTPInput-module_digitInput__JmEt3:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);\n}\n\n.OTPInput-module_success__hD6NL .OTPInput-module_digitInput__JmEt3 {\n border-color: var(--input-success-color);\n}\n\n.OTPInput-module_success__hD6NL .OTPInput-module_digitInput__JmEt3:focus {\n box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);\n}\n\n.OTPInput-module_helperText__8ml-k { font-size: 0.75rem; color: #6b7280; }\n.OTPInput-module_errorText__GuIyd { font-size: 0.75rem; color: var(--input-error-color); }\n.OTPInput-module_successText__mU1eR { font-size: 0.75rem; color: var(--input-success-color); }\n.OTPInput-module_warningText__LlJYz { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
769
|
+
var styles$2 = {"wrapper":"OTPInput-module_wrapper__ylADf","label":"OTPInput-module_label__Z5sSZ","required":"OTPInput-module_required__-26HV","inputsRow":"OTPInput-module_inputsRow__xHAzs","separator":"OTPInput-module_separator__1rLQ5","digitInput":"OTPInput-module_digitInput__JmEt3","sm":"OTPInput-module_sm__OBISd","lg":"OTPInput-module_lg__nv2s6","digitFilled":"OTPInput-module_digitFilled__66FNT","error":"OTPInput-module_error__bjKug","success":"OTPInput-module_success__hD6NL","helperText":"OTPInput-module_helperText__8ml-k","errorText":"OTPInput-module_errorText__GuIyd","successText":"OTPInput-module_successText__mU1eR","warningText":"OTPInput-module_warningText__LlJYz"};
|
|
770
|
+
styleInject(css_248z$2);
|
|
771
|
+
|
|
772
|
+
const OTPInput = forwardRef(({ size = 'md', validationState = 'default', label, helperText, errorMessage, required, disabled, wrapperClassName, wrapperStyle, labelClassName, labelStyle, helperTextClassName, helperTextStyle, id, length = 6, value, defaultValue, onChange, onComplete, inputType = 'numeric', mask, }, ref) => {
|
|
773
|
+
const generatedId = useId();
|
|
774
|
+
const groupId = id !== null && id !== void 0 ? id : `otp-${generatedId}`;
|
|
775
|
+
const helperId = `${groupId}-helper`;
|
|
776
|
+
const inputRefs = useRef([]);
|
|
777
|
+
const [internalValue, setInternalValue] = useControllable({
|
|
778
|
+
value,
|
|
779
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : '',
|
|
780
|
+
onChange,
|
|
781
|
+
});
|
|
782
|
+
const currentValue = internalValue !== null && internalValue !== void 0 ? internalValue : '';
|
|
783
|
+
const digits = Array.from({ length }, (_, i) => { var _a; return (_a = currentValue[i]) !== null && _a !== void 0 ? _a : ''; });
|
|
784
|
+
const isAllowed = useCallback((char) => {
|
|
785
|
+
if (inputType === 'numeric')
|
|
786
|
+
return /^\d$/.test(char);
|
|
787
|
+
return /^[a-zA-Z0-9]$/.test(char);
|
|
788
|
+
}, [inputType]);
|
|
789
|
+
const updateValue = useCallback((newDigits) => {
|
|
790
|
+
const newValue = newDigits.join('');
|
|
791
|
+
setInternalValue(newValue);
|
|
792
|
+
if (newValue.length === length && !newDigits.includes('')) {
|
|
793
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(newValue);
|
|
794
|
+
}
|
|
795
|
+
}, [length, setInternalValue, onComplete]);
|
|
796
|
+
const handleChange = useCallback((index, e) => {
|
|
797
|
+
var _a;
|
|
798
|
+
const raw = e.target.value;
|
|
799
|
+
const char = raw.slice(-1);
|
|
800
|
+
if (char && !isAllowed(char))
|
|
801
|
+
return;
|
|
802
|
+
const newDigits = [...digits];
|
|
803
|
+
newDigits[index] = char;
|
|
804
|
+
updateValue(newDigits);
|
|
805
|
+
if (char && index < length - 1) {
|
|
806
|
+
(_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
807
|
+
}
|
|
808
|
+
}, [digits, isAllowed, length, updateValue]);
|
|
809
|
+
const handleKeyDown = useCallback((index, e) => {
|
|
810
|
+
var _a, _b, _c;
|
|
811
|
+
if (e.key === 'Backspace') {
|
|
812
|
+
if (digits[index]) {
|
|
813
|
+
const newDigits = [...digits];
|
|
814
|
+
newDigits[index] = '';
|
|
815
|
+
updateValue(newDigits);
|
|
816
|
+
}
|
|
817
|
+
else if (index > 0) {
|
|
818
|
+
(_a = inputRefs.current[index - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
819
|
+
const newDigits = [...digits];
|
|
820
|
+
newDigits[index - 1] = '';
|
|
821
|
+
updateValue(newDigits);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
else if (e.key === 'ArrowLeft' && index > 0) {
|
|
825
|
+
(_b = inputRefs.current[index - 1]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
826
|
+
}
|
|
827
|
+
else if (e.key === 'ArrowRight' && index < length - 1) {
|
|
828
|
+
(_c = inputRefs.current[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
829
|
+
}
|
|
830
|
+
}, [digits, length, updateValue]);
|
|
831
|
+
const handlePaste = useCallback((e) => {
|
|
832
|
+
var _a;
|
|
833
|
+
e.preventDefault();
|
|
834
|
+
const pasted = e.clipboardData.getData('text').split('');
|
|
835
|
+
const newDigits = [...digits];
|
|
836
|
+
let filled = 0;
|
|
837
|
+
for (let i = 0; i < pasted.length && filled < length; i++) {
|
|
838
|
+
const char = pasted[i];
|
|
839
|
+
if (isAllowed(char)) {
|
|
840
|
+
const targetIdx = filled;
|
|
841
|
+
newDigits[targetIdx] = char;
|
|
842
|
+
filled++;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
updateValue(newDigits);
|
|
846
|
+
const nextFocus = Math.min(filled, length - 1);
|
|
847
|
+
(_a = inputRefs.current[nextFocus]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
848
|
+
}, [digits, isAllowed, length, updateValue]);
|
|
849
|
+
const activeMessage = validationState === 'error'
|
|
850
|
+
? errorMessage
|
|
851
|
+
: validationState === 'success'
|
|
852
|
+
? undefined
|
|
853
|
+
: helperText;
|
|
854
|
+
const messageClass = validationState === 'error'
|
|
855
|
+
? styles$2.errorText
|
|
856
|
+
: validationState === 'success'
|
|
857
|
+
? styles$2.successText
|
|
858
|
+
: validationState === 'warning'
|
|
859
|
+
? styles$2.warningText
|
|
860
|
+
: styles$2.helperText;
|
|
861
|
+
return (jsxs("div", { ref: ref, className: classNames(styles$2.wrapper, styles$2[size], validationState !== 'default' ? styles$2[validationState] : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { htmlFor: `${groupId}-0`, className: classNames(styles$2.label, required ? styles$2.required : undefined, labelClassName), style: labelStyle, children: label })), jsx("div", { className: styles$2.inputsRow, role: "group", "aria-label": label !== null && label !== void 0 ? label : 'One-time password', children: digits.map((digit, index) => (jsxs(React.Fragment, { children: [index === length / 2 && length > 4 && (jsx("span", { className: styles$2.separator, "aria-hidden": "true", children: "\u2014" })), jsx("input", { ref: (el) => { inputRefs.current[index] = el; }, id: index === 0 ? `${groupId}-0` : undefined, type: mask ? 'password' : 'text', inputMode: inputType === 'numeric' ? 'numeric' : 'text', maxLength: 1, value: digit, disabled: disabled, required: required && index === 0, onChange: (e) => handleChange(index, e), onKeyDown: (e) => handleKeyDown(index, e), onPaste: handlePaste, onFocus: (e) => e.target.select(), className: classNames(styles$2.digitInput, digit ? styles$2.digitFilled : undefined), "aria-label": `Digit ${index + 1} of ${length}`, autoComplete: index === 0 ? 'one-time-code' : 'off' })] }, index))) }), (activeMessage || (validationState === 'error' && errorMessage)) && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: validationState === 'error' ? errorMessage : activeMessage }))] }));
|
|
862
|
+
});
|
|
863
|
+
OTPInput.displayName = 'OTPInput';
|
|
864
|
+
|
|
865
|
+
var css_248z$1 = ".AutoComplete-module_wrapper__Xt0k7 {\n --input-primary-color: #3b82f6;\n --input-error-color: #ef4444;\n --input-success-color: #22c55e;\n --input-warning-color: #f59e0b;\n --input-border-color: #d1d5db;\n --input-bg-color: #ffffff;\n --input-text-color: #111827;\n --input-placeholder-color: #9ca3af;\n --input-border-radius: 6px;\n --input-font-family: inherit;\n --input-focus-ring-color: rgba(59, 130, 246, 0.5);\n --input-disabled-bg: #f3f4f6;\n --input-disabled-text: #9ca3af;\n display: inline-flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--input-font-family);\n position: relative;\n}\n\n.AutoComplete-module_fullWidth__FebWu { width: 100%; }\n\n.AutoComplete-module_label__Mg45U {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--input-text-color);\n}\n\n.AutoComplete-module_required__o79Ww::after {\n content: ' *';\n color: var(--input-error-color);\n}\n\n.AutoComplete-module_inputWrapper__fray2 {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.AutoComplete-module_input__g51MC {\n width: 100%;\n font-family: var(--input-font-family);\n color: var(--input-text-color);\n background-color: var(--input-bg-color);\n border-radius: var(--input-border-radius);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n box-sizing: border-box;\n}\n\n.AutoComplete-module_input__g51MC::placeholder {\n color: var(--input-placeholder-color);\n}\n\n.AutoComplete-module_sm__HXySZ .AutoComplete-module_input__g51MC { padding: 6px 32px 6px 10px; font-size: 0.75rem; height: 32px; }\n.AutoComplete-module_md__4a2vG .AutoComplete-module_input__g51MC { padding: 8px 36px 8px 12px; font-size: 0.875rem; height: 40px; }\n.AutoComplete-module_lg__RkNNN .AutoComplete-module_input__g51MC { padding: 10px 44px 10px 16px; font-size: 1rem; height: 48px; }\n\n.AutoComplete-module_outlined__8n-FG .AutoComplete-module_input__g51MC { border: 1px solid var(--input-border-color); }\n.AutoComplete-module_outlined__8n-FG .AutoComplete-module_input__g51MC:hover:not(:disabled) { border-color: var(--input-primary-color); }\n.AutoComplete-module_outlined__8n-FG .AutoComplete-module_input__g51MC:focus { border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.AutoComplete-module_filled__ZonX5 .AutoComplete-module_input__g51MC { border: 1px solid transparent; background-color: #f3f4f6; }\n.AutoComplete-module_filled__ZonX5 .AutoComplete-module_input__g51MC:hover:not(:disabled) { background-color: #e5e7eb; }\n.AutoComplete-module_filled__ZonX5 .AutoComplete-module_input__g51MC:focus { background-color: var(--input-bg-color); border-color: var(--input-primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring-color); }\n\n.AutoComplete-module_underlined__m-XYe .AutoComplete-module_input__g51MC { border: none; border-bottom: 2px solid var(--input-border-color); border-radius: 0; padding-left: 0; }\n.AutoComplete-module_underlined__m-XYe .AutoComplete-module_input__g51MC:hover:not(:disabled) { border-bottom-color: var(--input-primary-color); }\n.AutoComplete-module_underlined__m-XYe .AutoComplete-module_input__g51MC:focus { border-bottom-color: var(--input-primary-color); box-shadow: 0 2px 0 0 var(--input-focus-ring-color); }\n\n.AutoComplete-module_error__5DK2R .AutoComplete-module_input__g51MC { border-color: var(--input-error-color) !important; }\n.AutoComplete-module_error__5DK2R .AutoComplete-module_input__g51MC:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important; }\n.AutoComplete-module_success__w2wNi .AutoComplete-module_input__g51MC { border-color: var(--input-success-color) !important; }\n.AutoComplete-module_warning__lKl11 .AutoComplete-module_input__g51MC { border-color: var(--input-warning-color) !important; }\n\n.AutoComplete-module_input__g51MC:disabled { background-color: var(--input-disabled-bg); color: var(--input-disabled-text); cursor: not-allowed; }\n\n.AutoComplete-module_chevron__zs4E0 {\n position: absolute;\n right: 10px;\n color: var(--input-placeholder-color);\n pointer-events: none;\n font-size: 0.75rem;\n transition: transform 0.15s ease;\n}\n\n.AutoComplete-module_chevronOpen__PyIml {\n transform: rotate(180deg);\n}\n\n/* Dropdown */\n.AutoComplete-module_dropdown__NqO3E {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 1000;\n margin-top: 4px;\n background-color: var(--input-bg-color);\n border: 1px solid var(--input-border-color);\n border-radius: var(--input-border-radius);\n box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);\n max-height: 240px;\n overflow-y: auto;\n list-style: none;\n margin: 4px 0 0;\n padding: 4px 0;\n}\n\n.AutoComplete-module_option__Y-Kja {\n padding: 8px 12px;\n cursor: pointer;\n font-size: 0.875rem;\n color: var(--input-text-color);\n transition: background-color 0.1s ease;\n display: flex;\n align-items: center;\n}\n\n.AutoComplete-module_optionHighlighted__uAhz6 {\n background-color: #eff6ff;\n color: var(--input-primary-color);\n}\n\n.AutoComplete-module_optionSelected__OrY5D {\n background-color: #dbeafe;\n color: var(--input-primary-color);\n font-weight: 500;\n}\n\n.AutoComplete-module_optionDisabled__089aq {\n color: var(--input-disabled-text);\n cursor: not-allowed;\n}\n\n.AutoComplete-module_optionDisabled__089aq:hover {\n background-color: transparent;\n}\n\n.AutoComplete-module_noOptions__y6NiQ,\n.AutoComplete-module_loading__d-V8X {\n padding: 10px 12px;\n font-size: 0.875rem;\n color: var(--input-placeholder-color);\n text-align: center;\n}\n\n.AutoComplete-module_helperText__n1pbz { font-size: 0.75rem; color: #6b7280; }\n.AutoComplete-module_errorText__YJ8I3 { font-size: 0.75rem; color: var(--input-error-color); }\n.AutoComplete-module_successText__BcYro { font-size: 0.75rem; color: var(--input-success-color); }\n.AutoComplete-module_warningText__z9V-G { font-size: 0.75rem; color: var(--input-warning-color); }\n";
|
|
866
|
+
var styles$1 = {"wrapper":"AutoComplete-module_wrapper__Xt0k7","fullWidth":"AutoComplete-module_fullWidth__FebWu","label":"AutoComplete-module_label__Mg45U","required":"AutoComplete-module_required__o79Ww","inputWrapper":"AutoComplete-module_inputWrapper__fray2","input":"AutoComplete-module_input__g51MC","sm":"AutoComplete-module_sm__HXySZ","md":"AutoComplete-module_md__4a2vG","lg":"AutoComplete-module_lg__RkNNN","outlined":"AutoComplete-module_outlined__8n-FG","filled":"AutoComplete-module_filled__ZonX5","underlined":"AutoComplete-module_underlined__m-XYe","error":"AutoComplete-module_error__5DK2R","success":"AutoComplete-module_success__w2wNi","warning":"AutoComplete-module_warning__lKl11","chevron":"AutoComplete-module_chevron__zs4E0","chevronOpen":"AutoComplete-module_chevronOpen__PyIml","dropdown":"AutoComplete-module_dropdown__NqO3E","option":"AutoComplete-module_option__Y-Kja","optionHighlighted":"AutoComplete-module_optionHighlighted__uAhz6","optionSelected":"AutoComplete-module_optionSelected__OrY5D","optionDisabled":"AutoComplete-module_optionDisabled__089aq","noOptions":"AutoComplete-module_noOptions__y6NiQ","loading":"AutoComplete-module_loading__d-V8X","helperText":"AutoComplete-module_helperText__n1pbz","errorText":"AutoComplete-module_errorText__YJ8I3","successText":"AutoComplete-module_successText__BcYro","warningText":"AutoComplete-module_warningText__z9V-G"};
|
|
867
|
+
styleInject(css_248z$1);
|
|
868
|
+
|
|
869
|
+
const AutoComplete = forwardRef(({ size = 'md', variant = 'outlined', validationState = 'default', label, helperText, errorMessage, successMessage, warningMessage, required, disabled, readOnly, prefixIcon: _prefixIcon, suffixIcon: _suffixIcon, floatingLabel: _floatingLabel, fullWidth, wrapperClassName, wrapperStyle, labelClassName, labelStyle, inputClassName, inputStyle, helperTextClassName, helperTextStyle, id, className, options, value, defaultValue, onChange, onSelect, onSearch, loading, noOptionsMessage = 'No options found', allowCustomValue, placeholder, onBlur, onFocus, ...rest }, ref) => {
|
|
870
|
+
var _a;
|
|
871
|
+
const generatedId = useId();
|
|
872
|
+
const listboxId = `ac-listbox-${generatedId}`;
|
|
873
|
+
const { inputId, helperId, labelProps, inputAriaProps } = useFormField({
|
|
874
|
+
id,
|
|
875
|
+
helperText,
|
|
876
|
+
errorMessage,
|
|
877
|
+
validationState,
|
|
878
|
+
required,
|
|
879
|
+
disabled,
|
|
880
|
+
});
|
|
881
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
882
|
+
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
883
|
+
const [inputValue, setInputValue] = useState((_a = defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
884
|
+
const isControlled = value !== undefined;
|
|
885
|
+
const currentInputValue = isControlled ? value : inputValue;
|
|
886
|
+
const wrapperRef = useRef(null);
|
|
887
|
+
const blurTimeoutRef = useRef(null);
|
|
888
|
+
const filteredOptions = options.filter((opt) => opt.label.toLowerCase().includes(currentInputValue.toLowerCase()));
|
|
889
|
+
const handleInputChange = useCallback((e) => {
|
|
890
|
+
const newVal = e.target.value;
|
|
891
|
+
if (!isControlled)
|
|
892
|
+
setInputValue(newVal);
|
|
893
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newVal);
|
|
894
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(newVal);
|
|
895
|
+
setIsOpen(true);
|
|
896
|
+
setHighlightedIndex(-1);
|
|
897
|
+
}, [isControlled, onChange, onSearch]);
|
|
898
|
+
const selectOption = useCallback((option) => {
|
|
899
|
+
if (option.disabled)
|
|
900
|
+
return;
|
|
901
|
+
if (!isControlled)
|
|
902
|
+
setInputValue(option.label);
|
|
903
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(option.label);
|
|
904
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
|
|
905
|
+
setIsOpen(false);
|
|
906
|
+
setHighlightedIndex(-1);
|
|
907
|
+
}, [isControlled, onChange, onSelect]);
|
|
908
|
+
const handleKeyDown = useCallback((e) => {
|
|
909
|
+
if (!isOpen) {
|
|
910
|
+
if (e.key === 'ArrowDown' || e.key === 'Enter') {
|
|
911
|
+
setIsOpen(true);
|
|
912
|
+
}
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
if (e.key === 'ArrowDown') {
|
|
916
|
+
e.preventDefault();
|
|
917
|
+
setHighlightedIndex((i) => Math.min(i + 1, filteredOptions.length - 1));
|
|
918
|
+
}
|
|
919
|
+
else if (e.key === 'ArrowUp') {
|
|
920
|
+
e.preventDefault();
|
|
921
|
+
setHighlightedIndex((i) => Math.max(i - 1, 0));
|
|
922
|
+
}
|
|
923
|
+
else if (e.key === 'Enter') {
|
|
924
|
+
e.preventDefault();
|
|
925
|
+
if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
|
|
926
|
+
selectOption(filteredOptions[highlightedIndex]);
|
|
927
|
+
}
|
|
928
|
+
else if (allowCustomValue) {
|
|
929
|
+
setIsOpen(false);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
else if (e.key === 'Escape') {
|
|
933
|
+
setIsOpen(false);
|
|
934
|
+
setHighlightedIndex(-1);
|
|
935
|
+
}
|
|
936
|
+
}, [isOpen, filteredOptions, highlightedIndex, selectOption, allowCustomValue]);
|
|
937
|
+
const handleFocus = useCallback((e) => {
|
|
938
|
+
setIsOpen(true);
|
|
939
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
940
|
+
}, [onFocus]);
|
|
941
|
+
const handleBlur = useCallback((e) => {
|
|
942
|
+
// Clear any existing timeout
|
|
943
|
+
if (blurTimeoutRef.current) {
|
|
944
|
+
clearTimeout(blurTimeoutRef.current);
|
|
945
|
+
}
|
|
946
|
+
blurTimeoutRef.current = setTimeout(() => {
|
|
947
|
+
var _a;
|
|
948
|
+
if (!((_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))) {
|
|
949
|
+
setIsOpen(false);
|
|
950
|
+
}
|
|
951
|
+
}, DROPDOWN_BLUR_DELAY_MS);
|
|
952
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
953
|
+
}, [onBlur]);
|
|
954
|
+
// Cleanup blur timeout on unmount
|
|
955
|
+
useEffect(() => {
|
|
956
|
+
return () => {
|
|
957
|
+
if (blurTimeoutRef.current) {
|
|
958
|
+
clearTimeout(blurTimeoutRef.current);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
}, []);
|
|
962
|
+
// Close dropdown on outside click
|
|
963
|
+
useEffect(() => {
|
|
964
|
+
const handleClick = (e) => {
|
|
965
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
966
|
+
setIsOpen(false);
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
document.addEventListener('mousedown', handleClick);
|
|
970
|
+
return () => document.removeEventListener('mousedown', handleClick);
|
|
971
|
+
}, []);
|
|
972
|
+
const activeMessage = getValidationMessage(validationState, errorMessage, successMessage, warningMessage, helperText);
|
|
973
|
+
const messageClass = getValidationMessageClass(validationState, styles$1);
|
|
974
|
+
const showDropdown = isOpen && !disabled && !readOnly;
|
|
975
|
+
return (jsxs("div", { ref: wrapperRef, className: classNames(styles$1.wrapper, styles$1[size], styles$1[variant], validationState !== 'default' ? styles$1[validationState] : undefined, fullWidth ? styles$1.fullWidth : undefined, wrapperClassName), style: wrapperStyle, children: [label && (jsx("label", { ...labelProps, className: classNames(styles$1.label, required ? styles$1.required : undefined, labelClassName), style: labelStyle, children: label })), jsxs("div", { className: styles$1.inputWrapper, children: [jsx("input", { ...rest, ...inputAriaProps, ref: ref, id: inputId, type: "text", disabled: disabled, readOnly: readOnly, required: required, placeholder: placeholder, value: currentInputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, role: "combobox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-autocomplete": "list", "aria-activedescendant": highlightedIndex >= 0
|
|
976
|
+
? `${listboxId}-option-${highlightedIndex}`
|
|
977
|
+
: undefined, className: classNames(styles$1.input, inputClassName, className), style: inputStyle }), jsx("span", { className: classNames(styles$1.chevron, showDropdown ? styles$1.chevronOpen : undefined), "aria-hidden": "true", children: "\u25BE" })] }), showDropdown && (jsx("ul", { id: listboxId, role: "listbox", className: styles$1.dropdown, "aria-label": label !== null && label !== void 0 ? label : 'Suggestions', children: loading ? (jsx("li", { className: styles$1.loading, children: "Loading\u2026" })) : filteredOptions.length === 0 ? (jsx("li", { className: styles$1.noOptions, children: noOptionsMessage })) : (filteredOptions.map((option, index) => (jsx("li", { id: `${listboxId}-option-${index}`, role: "option", "aria-selected": option.label === currentInputValue, "aria-disabled": option.disabled, className: classNames(styles$1.option, index === highlightedIndex ? styles$1.optionHighlighted : undefined, option.label === currentInputValue ? styles$1.optionSelected : undefined, option.disabled ? styles$1.optionDisabled : undefined), onMouseDown: (e) => {
|
|
978
|
+
e.preventDefault();
|
|
979
|
+
selectOption(option);
|
|
980
|
+
}, onMouseEnter: () => setHighlightedIndex(index), children: option.label }, option.value)))) })), activeMessage && (jsx("span", { id: helperId, className: classNames(messageClass, helperTextClassName), style: helperTextStyle, children: activeMessage }))] }));
|
|
981
|
+
});
|
|
982
|
+
AutoComplete.displayName = 'AutoComplete';
|
|
983
|
+
|
|
984
|
+
var css_248z = ".DataTable-module_wrapper__iB6ka {\n --dt-border-color: #d1d5db;\n --dt-bg-color: #ffffff;\n --dt-text-color: #111827;\n --dt-header-bg: #f9fafb;\n --dt-header-text: #374151;\n --dt-row-hover-bg: #f3f4f6;\n --dt-primary-color: #3b82f6;\n --dt-primary-focus-ring: rgba(59, 130, 246, 0.4);\n --dt-active-filter-color: #2563eb;\n --dt-dropdown-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n --dt-border-radius: 6px;\n --dt-font-family: inherit;\n font-family: var(--dt-font-family);\n color: var(--dt-text-color);\n display: block;\n}\n\n/* Horizontally scrollable container so wide tables don't break layout */\n.DataTable-module_tableContainer__-u5tn {\n width: 100%;\n overflow-x: auto;\n border: 1px solid var(--dt-border-color);\n border-radius: var(--dt-border-radius);\n}\n\n.DataTable-module_table__oL4Dz {\n width: 100%;\n border-collapse: collapse;\n font-size: 0.875rem;\n background-color: var(--dt-bg-color);\n}\n\n/* ── Header ──────────────────────────────────────────── */\n\n.DataTable-module_th__jFpTv {\n padding: 10px 14px;\n text-align: left;\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--dt-header-text);\n background-color: var(--dt-header-bg);\n border-bottom: 1px solid var(--dt-border-color);\n white-space: nowrap;\n}\n\n.DataTable-module_thContent__J4j9A {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.DataTable-module_headerText__AzimD {\n flex: 1;\n}\n\n/* ── Filter button & dropdown ─────────────────────────── */\n\n.DataTable-module_filterContainer__ClpaH {\n position: relative;\n display: inline-flex;\n align-items: center;\n}\n\n.DataTable-module_filterButton__ndWCp {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: 1px solid transparent;\n border-radius: 4px;\n padding: 2px 4px;\n cursor: pointer;\n color: #9ca3af;\n line-height: 1;\n transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;\n}\n\n.DataTable-module_filterButton__ndWCp:hover {\n color: var(--dt-primary-color);\n background-color: #eff6ff;\n border-color: #bfdbfe;\n}\n\n.DataTable-module_filterButton__ndWCp:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px var(--dt-primary-focus-ring);\n}\n\n.DataTable-module_filterButtonActive__SmXd9 {\n color: var(--dt-active-filter-color);\n background-color: #dbeafe;\n border-color: #93c5fd;\n}\n\n.DataTable-module_filterArrow__dOd4L {\n font-size: 0.75rem;\n display: inline-block;\n transition: transform 0.15s ease;\n}\n\n.DataTable-module_filterArrowOpen__Xvy3v {\n transform: rotate(180deg);\n}\n\n.DataTable-module_filterDropdown__yA3MC {\n position: absolute;\n top: calc(100% + 6px);\n left: 50%;\n transform: translateX(-50%);\n z-index: 1000;\n min-width: 160px;\n max-width: 260px;\n background-color: var(--dt-bg-color);\n border: 1px solid var(--dt-border-color);\n border-radius: var(--dt-border-radius);\n box-shadow: var(--dt-dropdown-shadow);\n padding: 4px 0;\n}\n\n.DataTable-module_filterList__jWtZQ {\n list-style: none;\n margin: 0;\n padding: 4px 0;\n max-height: 200px;\n overflow-y: auto;\n}\n\n.DataTable-module_filterItem__-zo0D {\n padding: 0;\n}\n\n.DataTable-module_filterLabel__RHEuV {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 7px 12px;\n cursor: pointer;\n font-size: 0.8125rem;\n color: var(--dt-text-color);\n transition: background-color 0.1s ease;\n user-select: none;\n}\n\n.DataTable-module_filterLabel__RHEuV:hover {\n background-color: #eff6ff;\n}\n\n.DataTable-module_filterCheckbox__eN71a {\n width: 15px;\n height: 15px;\n accent-color: var(--dt-primary-color);\n cursor: pointer;\n flex-shrink: 0;\n}\n\n.DataTable-module_filterValueText__REuyI {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.DataTable-module_filterEmpty__hEO-0 {\n padding: 10px 12px;\n font-size: 0.8125rem;\n color: #9ca3af;\n text-align: center;\n}\n\n.DataTable-module_filterActions__6FvQn {\n border-top: 1px solid var(--dt-border-color);\n padding: 6px 8px;\n display: flex;\n justify-content: flex-end;\n}\n\n.DataTable-module_clearButton__bp2du {\n background: none;\n border: none;\n font-size: 0.75rem;\n color: var(--dt-primary-color);\n cursor: pointer;\n padding: 2px 6px;\n border-radius: 4px;\n transition: background-color 0.1s ease;\n}\n\n.DataTable-module_clearButton__bp2du:hover {\n background-color: #eff6ff;\n}\n\n.DataTable-module_clearButton__bp2du:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px var(--dt-primary-focus-ring);\n}\n\n/* ── Body ─────────────────────────────────────────────── */\n\n.DataTable-module_tr__t3OSd {\n transition: background-color 0.1s ease;\n}\n\n.DataTable-module_tr__t3OSd:hover {\n background-color: var(--dt-row-hover-bg);\n}\n\n.DataTable-module_tr__t3OSd:not(:last-child) {\n border-bottom: 1px solid var(--dt-border-color);\n}\n\n.DataTable-module_td__kjyJu {\n padding: 10px 14px;\n vertical-align: middle;\n color: var(--dt-text-color);\n font-size: 0.875rem;\n}\n\n/* ── Empty state ─────────────────────────────────────── */\n\n.DataTable-module_emptyCell__JORLK {\n padding: 24px 14px;\n text-align: center;\n color: #9ca3af;\n font-size: 0.875rem;\n}\n";
|
|
985
|
+
var styles = {"wrapper":"DataTable-module_wrapper__iB6ka","tableContainer":"DataTable-module_tableContainer__-u5tn","table":"DataTable-module_table__oL4Dz","th":"DataTable-module_th__jFpTv","thContent":"DataTable-module_thContent__J4j9A","headerText":"DataTable-module_headerText__AzimD","filterContainer":"DataTable-module_filterContainer__ClpaH","filterButton":"DataTable-module_filterButton__ndWCp","filterButtonActive":"DataTable-module_filterButtonActive__SmXd9","filterArrow":"DataTable-module_filterArrow__dOd4L","filterArrowOpen":"DataTable-module_filterArrowOpen__Xvy3v","filterDropdown":"DataTable-module_filterDropdown__yA3MC","filterList":"DataTable-module_filterList__jWtZQ","filterItem":"DataTable-module_filterItem__-zo0D","filterLabel":"DataTable-module_filterLabel__RHEuV","filterCheckbox":"DataTable-module_filterCheckbox__eN71a","filterValueText":"DataTable-module_filterValueText__REuyI","filterEmpty":"DataTable-module_filterEmpty__hEO-0","filterActions":"DataTable-module_filterActions__6FvQn","clearButton":"DataTable-module_clearButton__bp2du","tr":"DataTable-module_tr__t3OSd","td":"DataTable-module_td__kjyJu","emptyCell":"DataTable-module_emptyCell__JORLK"};
|
|
986
|
+
styleInject(css_248z);
|
|
987
|
+
|
|
988
|
+
function DataTable({ columns, data, rowKey, className, style, emptyMessage = 'No data available', }) {
|
|
989
|
+
/** Key of the column whose filter dropdown is currently open */
|
|
990
|
+
const [openFilterKey, setOpenFilterKey] = useState(null);
|
|
991
|
+
/**
|
|
992
|
+
* Active filter selections: maps column key → array of selected string values.
|
|
993
|
+
* An empty (or absent) array means "no filter applied" for that column.
|
|
994
|
+
*/
|
|
995
|
+
const [activeFilters, setActiveFilters] = useState({});
|
|
996
|
+
const wrapperRef = useRef(null);
|
|
997
|
+
/** Close the open dropdown when user clicks outside the table wrapper */
|
|
998
|
+
useEffect(() => {
|
|
999
|
+
const handleOutsideClick = (e) => {
|
|
1000
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
1001
|
+
setOpenFilterKey(null);
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
document.addEventListener('mousedown', handleOutsideClick);
|
|
1005
|
+
return () => document.removeEventListener('mousedown', handleOutsideClick);
|
|
1006
|
+
}, []);
|
|
1007
|
+
/** Returns sorted unique string values for a given column key from ALL rows */
|
|
1008
|
+
const getUniqueValues = useCallback((key) => {
|
|
1009
|
+
const seen = new Set();
|
|
1010
|
+
data.forEach((row) => { var _a; return seen.add(String((_a = row[key]) !== null && _a !== void 0 ? _a : '')); });
|
|
1011
|
+
return Array.from(seen).sort((a, b) => a.localeCompare(b));
|
|
1012
|
+
}, [data]);
|
|
1013
|
+
/** Toggle the filter dropdown for a column */
|
|
1014
|
+
const toggleFilterDropdown = useCallback((key) => {
|
|
1015
|
+
setOpenFilterKey((prev) => (prev === key ? null : key));
|
|
1016
|
+
}, []);
|
|
1017
|
+
/** Toggle a single checkbox value inside a column's filter */
|
|
1018
|
+
const toggleFilterValue = useCallback((columnKey, value) => {
|
|
1019
|
+
setActiveFilters((prev) => {
|
|
1020
|
+
var _a;
|
|
1021
|
+
const current = (_a = prev[columnKey]) !== null && _a !== void 0 ? _a : [];
|
|
1022
|
+
const next = current.includes(value)
|
|
1023
|
+
? current.filter((v) => v !== value)
|
|
1024
|
+
: [...current, value];
|
|
1025
|
+
return { ...prev, [columnKey]: next };
|
|
1026
|
+
});
|
|
1027
|
+
}, []);
|
|
1028
|
+
/** Clear all selected values for a column filter */
|
|
1029
|
+
const clearFilter = useCallback((columnKey) => {
|
|
1030
|
+
setActiveFilters((prev) => ({ ...prev, [columnKey]: [] }));
|
|
1031
|
+
}, []);
|
|
1032
|
+
/** Rows after applying all active filters (AND across columns, OR within a column) */
|
|
1033
|
+
const filteredData = useMemo(() => {
|
|
1034
|
+
return data.filter((row) => columns.every((col) => {
|
|
1035
|
+
var _a;
|
|
1036
|
+
if (!col.filterable)
|
|
1037
|
+
return true;
|
|
1038
|
+
const selected = activeFilters[col.key];
|
|
1039
|
+
if (!selected || selected.length === 0)
|
|
1040
|
+
return true;
|
|
1041
|
+
return selected.includes(String((_a = row[col.key]) !== null && _a !== void 0 ? _a : ''));
|
|
1042
|
+
}));
|
|
1043
|
+
}, [data, columns, activeFilters]);
|
|
1044
|
+
return (jsx("div", { ref: wrapperRef, className: classNames(styles.wrapper, className), style: style, children: jsx("div", { className: styles.tableContainer, children: jsxs("table", { className: styles.table, children: [jsx("thead", { children: jsx("tr", { children: columns.map((col) => {
|
|
1045
|
+
var _a;
|
|
1046
|
+
const isOpen = openFilterKey === col.key;
|
|
1047
|
+
const selectedValues = (_a = activeFilters[col.key]) !== null && _a !== void 0 ? _a : [];
|
|
1048
|
+
const isActive = selectedValues.length > 0;
|
|
1049
|
+
const uniqueValues = col.filterable ? getUniqueValues(col.key) : [];
|
|
1050
|
+
return (jsx("th", { className: styles.th, style: col.width === undefined ? undefined : { width: col.width }, children: jsxs("div", { className: styles.thContent, children: [jsx("span", { className: styles.headerText, children: col.header }), col.filterable && (jsxs("div", { className: styles.filterContainer, children: [jsx("button", { type: "button", "aria-label": `Filter by ${col.header}`, "aria-expanded": isOpen, "aria-haspopup": "listbox", className: classNames(styles.filterButton, isActive ? styles.filterButtonActive : undefined), onClick: () => toggleFilterDropdown(col.key), children: jsx("span", { className: classNames(styles.filterArrow, isOpen ? styles.filterArrowOpen : undefined), "aria-hidden": "true", children: "\u25BE" }) }), isOpen && (jsxs("div", { className: styles.filterDropdown, role: "dialog", "aria-label": `Filter options for ${col.header}`, children: [jsx("ul", { className: styles.filterList, role: "listbox", children: uniqueValues.length === 0 ? (jsx("li", { className: styles.filterEmpty, children: "No options" })) : (uniqueValues.map((val, valIndex) => {
|
|
1051
|
+
const checked = selectedValues.includes(val);
|
|
1052
|
+
const checkboxId = `dt-filter-${col.key}-${valIndex}`;
|
|
1053
|
+
return (jsx("li", { className: styles.filterItem, children: jsxs("label", { htmlFor: checkboxId, className: styles.filterLabel, children: [jsx("input", { id: checkboxId, type: "checkbox", checked: checked, onChange: () => toggleFilterValue(col.key, val), className: styles.filterCheckbox }), jsx("span", { className: styles.filterValueText, children: val })] }) }, val));
|
|
1054
|
+
})) }), selectedValues.length > 0 && (jsx("div", { className: styles.filterActions, children: jsx("button", { type: "button", className: styles.clearButton, onClick: () => clearFilter(col.key), children: "Clear" }) }))] }))] }))] }) }, col.key));
|
|
1055
|
+
}) }) }), jsx("tbody", { children: filteredData.length === 0 ? (jsx("tr", { children: jsx("td", { colSpan: columns.length, className: styles.emptyCell, children: emptyMessage }) })) : (filteredData.map((row, rowIndex) => (jsx("tr", { className: styles.tr, children: columns.map((col) => {
|
|
1056
|
+
var _a;
|
|
1057
|
+
return (jsx("td", { className: styles.td, children: col.render
|
|
1058
|
+
? col.render(row[col.key], row)
|
|
1059
|
+
: String((_a = row[col.key]) !== null && _a !== void 0 ? _a : '') }, col.key));
|
|
1060
|
+
}) }, rowKey ? rowKey(row, rowIndex) : rowIndex)))) })] }) }) }));
|
|
1061
|
+
}
|
|
1062
|
+
DataTable.displayName = 'DataTable';
|
|
1063
|
+
|
|
1064
|
+
const ThemeContext = createContext({ theme: {} });
|
|
1065
|
+
function ThemeProvider({ theme, children }) {
|
|
1066
|
+
const cssVars = {};
|
|
1067
|
+
if (theme.primaryColor)
|
|
1068
|
+
cssVars['--input-primary-color'] = theme.primaryColor;
|
|
1069
|
+
if (theme.errorColor)
|
|
1070
|
+
cssVars['--input-error-color'] = theme.errorColor;
|
|
1071
|
+
if (theme.successColor)
|
|
1072
|
+
cssVars['--input-success-color'] = theme.successColor;
|
|
1073
|
+
if (theme.warningColor)
|
|
1074
|
+
cssVars['--input-warning-color'] = theme.warningColor;
|
|
1075
|
+
if (theme.borderRadius)
|
|
1076
|
+
cssVars['--input-border-radius'] = theme.borderRadius;
|
|
1077
|
+
if (theme.fontFamily)
|
|
1078
|
+
cssVars['--input-font-family'] = theme.fontFamily;
|
|
1079
|
+
if (theme.fontSize)
|
|
1080
|
+
cssVars['--input-font-size'] = theme.fontSize;
|
|
1081
|
+
if (theme.borderColor)
|
|
1082
|
+
cssVars['--input-border-color'] = theme.borderColor;
|
|
1083
|
+
if (theme.bgColor)
|
|
1084
|
+
cssVars['--input-bg-color'] = theme.bgColor;
|
|
1085
|
+
if (theme.textColor)
|
|
1086
|
+
cssVars['--input-text-color'] = theme.textColor;
|
|
1087
|
+
if (theme.placeholderColor)
|
|
1088
|
+
cssVars['--input-placeholder-color'] = theme.placeholderColor;
|
|
1089
|
+
if (theme.focusRingColor)
|
|
1090
|
+
cssVars['--input-focus-ring-color'] = theme.focusRingColor;
|
|
1091
|
+
if (theme.disabledBg)
|
|
1092
|
+
cssVars['--input-disabled-bg'] = theme.disabledBg;
|
|
1093
|
+
if (theme.disabledText)
|
|
1094
|
+
cssVars['--input-disabled-text'] = theme.disabledText;
|
|
1095
|
+
return (jsx(ThemeContext.Provider, { value: { theme }, children: jsx("div", { style: cssVars, children: children }) }));
|
|
1096
|
+
}
|
|
1097
|
+
function useTheme() {
|
|
1098
|
+
return useContext(ThemeContext);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export { AutoComplete, Checkbox, CheckboxGroup, ColorInput, DataTable, DateInput, FileInput, NumberInput, OTPInput, PasswordInput, PhoneInput, RadioGroup, RangeInput, SearchInput, SelectInput, TextArea, TextInput, ThemeProvider, TimeInput, Toggle, useControllable, useFormField, useTheme };
|
|
1102
|
+
//# sourceMappingURL=index.js.map
|