@versini/ui-textinput 6.4.4 → 7.0.1
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/README.md +0 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +8 -15
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -153,7 +153,6 @@ function App() {
|
|
|
153
153
|
| helperText | `string` | - | Text to add to the bottom of the TextInput |
|
|
154
154
|
| size | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Controls input height and padding |
|
|
155
155
|
| mode | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | The mode of TextInput (controls color) |
|
|
156
|
-
| focusMode | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | The focus ring color mode |
|
|
157
156
|
| labelHidden | `boolean` | `false` | Hides the label visually but retains accessibility |
|
|
158
157
|
| labelId | `string` | - | Id to use for the TextInput label |
|
|
159
158
|
| noBorder | `boolean` | `false` | Whether the TextInput has a border |
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ declare type CommonTextInputProps = {
|
|
|
14
14
|
* @default false
|
|
15
15
|
*/
|
|
16
16
|
error?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The type of focus for the TextInput. This will change the color
|
|
19
|
-
* of the focus ring around the TextInput.
|
|
20
|
-
*/
|
|
21
|
-
focusMode?: "dark" | "light" | "system" | "alt-system";
|
|
22
17
|
/**
|
|
23
18
|
* Text to add to the bottom of the TextInput.
|
|
24
19
|
*/
|
|
@@ -65,7 +60,7 @@ export declare const TEXT_INPUT_SIMPLE_CLASSNAME = "av-text-input-simple";
|
|
|
65
60
|
|
|
66
61
|
export declare const TEXT_INPUT_WRAPPER_CLASSNAME = "av-text-input-wrapper";
|
|
67
62
|
|
|
68
|
-
export declare function TextInput({ id, name, label, error, raw, className, inputClassName, mode,
|
|
63
|
+
export declare function TextInput({ id, name, label, error, raw, className, inputClassName, mode, disabled, noBorder, labelId, labelHidden, type, helperText, rightElement, rightElementClassName, size, ref, ...extraProps }: TextInputProps): JSX.Element;
|
|
69
64
|
|
|
70
65
|
export declare function TextInputMask({ name, disabled, label, labelHidden, onMaskChange, onChange, onBlur, onFocus, onTextInputMaskBlur, rightElement, ref, ...otherProps }: TextInputMaskProps): JSX.Element;
|
|
71
66
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-textinput
|
|
2
|
+
@versini/ui-textinput v7.0.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -32,13 +32,8 @@ const getTextInputColorClasses = ({ mode })=>{
|
|
|
32
32
|
"bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": mode === "alt-system"
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
const getTextInputFocusClasses = (
|
|
36
|
-
return clsx("focus:outline-2 focus:outline-offset-2"
|
|
37
|
-
"focus:outline-focus-dark": focusMode === "dark",
|
|
38
|
-
"focus:outline-focus-light": focusMode === "light",
|
|
39
|
-
"focus:outline-focus-light dark:focus:outline-focus-dark": focusMode === "alt-system",
|
|
40
|
-
"focus:outline-focus-dark dark:focus:outline-focus-light": focusMode === "system"
|
|
41
|
-
});
|
|
35
|
+
const getTextInputFocusClasses = ()=>{
|
|
36
|
+
return clsx("focus:outline-2 focus:outline-offset-2 focus:outline-focus-dark");
|
|
42
37
|
};
|
|
43
38
|
const getTextInputBorderClasses = ({ noBorder, error })=>{
|
|
44
39
|
return clsx("border-2", {
|
|
@@ -96,7 +91,7 @@ const getTextInputHelperTextClasses = ({ error, raw, mode, disabled })=>{
|
|
|
96
91
|
});
|
|
97
92
|
}
|
|
98
93
|
/* v8 ignore stop */ };
|
|
99
|
-
const getTextInputClasses = ({ className, inputClassName, raw, disabled, noBorder, error, mode,
|
|
94
|
+
const getTextInputClasses = ({ className, inputClassName, raw, disabled, noBorder, error, mode, size, rightElementClassName })=>{
|
|
100
95
|
const wrapper = raw ? className : clsx("relative flex w-full flex-col justify-center", TEXT_INPUT_WRAPPER_CLASSNAME, className);
|
|
101
96
|
let heightClass = "";
|
|
102
97
|
switch(size){
|
|
@@ -118,9 +113,7 @@ const getTextInputClasses = ({ className, inputClassName, raw, disabled, noBorde
|
|
|
118
113
|
}
|
|
119
114
|
const input = raw ? clsx(inputClassName) : clsx(TEXT_INPUT_CLASSNAME, heightClass, "rounded-md text-base px-4", getTextInputColorClasses({
|
|
120
115
|
mode
|
|
121
|
-
}), getTextInputFocusClasses({
|
|
122
|
-
focusMode
|
|
123
|
-
}), getTextInputBorderClasses({
|
|
116
|
+
}), getTextInputFocusClasses(), getTextInputBorderClasses({
|
|
124
117
|
noBorder,
|
|
125
118
|
error
|
|
126
119
|
}), {
|
|
@@ -157,7 +150,7 @@ const getTextInputClasses = ({ className, inputClassName, raw, disabled, noBorde
|
|
|
157
150
|
|
|
158
151
|
|
|
159
152
|
|
|
160
|
-
function TextInput({ id, name, label, error = false, raw = false, className, inputClassName, mode = "system",
|
|
153
|
+
function TextInput({ id, name, label, error = false, raw = false, className, inputClassName, mode = "system", disabled = false, noBorder = false, labelId, labelHidden = false, type = "text", helperText = "", rightElement, rightElementClassName, size = "md", ref, ...extraProps }) {
|
|
161
154
|
const [rightElementRef, rect] = useResizeObserver();
|
|
162
155
|
const [inputPaddingRight, setInputPaddingRight] = useState(0);
|
|
163
156
|
const inputId = useUniqueId({
|
|
@@ -194,7 +187,6 @@ function TextInput({ id, name, label, error = false, raw = false, className, inp
|
|
|
194
187
|
inputClassName,
|
|
195
188
|
error,
|
|
196
189
|
raw,
|
|
197
|
-
focusMode,
|
|
198
190
|
disabled,
|
|
199
191
|
noBorder,
|
|
200
192
|
mode,
|
|
@@ -217,7 +209,8 @@ function TextInput({ id, name, label, error = false, raw = false, className, inp
|
|
|
217
209
|
/* c8 ignore end */ /**
|
|
218
210
|
* This effect sets the label and helper text position based on
|
|
219
211
|
* the size of the input.
|
|
220
|
-
*/
|
|
212
|
+
*/ // biome-ignore lint/correctness/useExhaustiveDependencies: The sizeStyles object is static and does not change, so it does not need to be included in the dependency array. --- IGNORE ---
|
|
213
|
+
useLayoutEffect(()=>{
|
|
221
214
|
const { label, helperText } = sizeStyles[size];
|
|
222
215
|
labelRef?.current?.style.setProperty("--av-text-input-label", label);
|
|
223
216
|
helperTextRef?.current?.style.setProperty("--av-text-input-helper-text", helperText);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-textinput",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@testing-library/jest-dom": "6.9.1",
|
|
41
|
-
"@versini/ui-types": "
|
|
41
|
+
"@versini/ui-types": "9.1.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@versini/ui-hooks": "6.1.1",
|
|
45
|
-
"@versini/ui-liveregion": "3.2.
|
|
45
|
+
"@versini/ui-liveregion": "3.2.7",
|
|
46
46
|
"clsx": "2.1.1",
|
|
47
47
|
"tailwindcss": "4.2.1"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": [
|
|
50
50
|
"**/*.css"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e1d07ef9f8c39af8e1cf471a2d1688f4bca1771c"
|
|
53
53
|
}
|