@festo-ui/react 9.0.1-dev.806 → 9.0.1-dev.807
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.
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"], label.fwe-input-text input[type="password"][aria-invalid="true"], label.fwe-input-text input[type="date"][aria-invalid="true"], label.fwe-input-text input[type="datetime-local"][aria-invalid="true"], label.fwe-input-text input[type="number"][aria-invalid="true"] {
|
|
2
|
+
box-shadow: none;
|
|
3
|
+
outline: none;
|
|
4
|
+
border-bottom: 1px solid var(--fwe-red) !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"]:focus, label.fwe-input-text input[type="password"][aria-invalid="true"]:focus, label.fwe-input-text input[type="date"][aria-invalid="true"]:focus, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"]:focus, label.fwe-input-text input[type="number"][aria-invalid="true"]:focus {
|
|
8
|
+
border-bottom: 1px solid var(--fwe-red) !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"]:disabled, label.fwe-input-text input[type="password"][aria-invalid="true"]:disabled, label.fwe-input-text input[type="date"][aria-invalid="true"]:disabled, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"]:disabled, label.fwe-input-text input[type="number"][aria-invalid="true"]:disabled {
|
|
12
|
+
border-bottom: 1px solid var(--fwe-control-disabled) !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"]:disabled ~ .fwe-input-text-label, label.fwe-input-text input[type="text"][aria-invalid="true"]:disabled ~ .fwe-input-text-invalid, label.fwe-input-text input[type="text"][aria-invalid="true"]:disabled ~ .fwe-input-text-info, label.fwe-input-text input[type="password"][aria-invalid="true"]:disabled ~ .fwe-input-text-label, label.fwe-input-text input[type="password"][aria-invalid="true"]:disabled ~ .fwe-input-text-invalid, label.fwe-input-text input[type="password"][aria-invalid="true"]:disabled ~ .fwe-input-text-info, label.fwe-input-text input[type="date"][aria-invalid="true"]:disabled ~ .fwe-input-text-label, label.fwe-input-text input[type="date"][aria-invalid="true"]:disabled ~ .fwe-input-text-invalid, label.fwe-input-text input[type="date"][aria-invalid="true"]:disabled ~ .fwe-input-text-info, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"]:disabled ~ .fwe-input-text-label, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"]:disabled ~ .fwe-input-text-invalid, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"]:disabled ~ .fwe-input-text-info, label.fwe-input-text input[type="number"][aria-invalid="true"]:disabled ~ .fwe-input-text-label, label.fwe-input-text input[type="number"][aria-invalid="true"]:disabled ~ .fwe-input-text-invalid, label.fwe-input-text input[type="number"][aria-invalid="true"]:disabled ~ .fwe-input-text-info {
|
|
16
|
+
color: var(--fwe-text-disabled);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"] ~ .fwe-input-text-info, label.fwe-input-text input[type="password"][aria-invalid="true"] ~ .fwe-input-text-info, label.fwe-input-text input[type="date"][aria-invalid="true"] ~ .fwe-input-text-info, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"] ~ .fwe-input-text-info, label.fwe-input-text input[type="number"][aria-invalid="true"] ~ .fwe-input-text-info {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
label.fwe-input-text input[type="text"][aria-invalid="true"] ~ .fwe-input-text-invalid, label.fwe-input-text input[type="password"][aria-invalid="true"] ~ .fwe-input-text-invalid, label.fwe-input-text input[type="date"][aria-invalid="true"] ~ .fwe-input-text-invalid, label.fwe-input-text input[type="datetime-local"][aria-invalid="true"] ~ .fwe-input-text-invalid, label.fwe-input-text input[type="number"][aria-invalid="true"] ~ .fwe-input-text-invalid {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
label.fwe-input-text:has(input:disabled) {
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
+
import './TextInput.scss';
|
|
1
2
|
import type React from 'react';
|
|
2
|
-
export interface TextInputProps {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
required?: boolean;
|
|
3
|
+
export interface TextInputProps extends React.HTMLProps<HTMLInputElement> {
|
|
5
4
|
readonly?: boolean;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
type?: string;
|
|
8
|
-
step?: string;
|
|
9
|
-
min?: number;
|
|
10
|
-
max?: number;
|
|
11
5
|
value?: string;
|
|
12
6
|
defaultValue?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
15
|
-
onInput?: (event: React.FormEvent<HTMLInputElement>) => void;
|
|
16
|
-
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
17
|
-
label?: string;
|
|
18
7
|
hint?: string;
|
|
19
8
|
error?: string;
|
|
20
9
|
labelClassName?: string;
|
|
21
10
|
icon?: React.ReactNode;
|
|
22
|
-
autoFocus?: boolean;
|
|
23
11
|
}
|
|
24
|
-
export declare const TextInput: (props: TextInputProps & React.
|
|
12
|
+
export declare const TextInput: (props: TextInputProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./TextInput.css";
|
|
2
3
|
import classnames from "classnames";
|
|
3
4
|
import { forwardRef, useEffect, useRef } from "react";
|
|
4
5
|
import { useId } from "../../utils/useId.js";
|
|
5
|
-
const
|
|
6
|
+
const SUPPORTED_INPUT_TYPES = [
|
|
7
|
+
'text',
|
|
8
|
+
'number',
|
|
9
|
+
'password',
|
|
10
|
+
'datetime-local'
|
|
11
|
+
];
|
|
12
|
+
const TextInput = /*#__PURE__*/ forwardRef(({ readonly, type, value, defaultValue, error, hint, label, labelClassName, icon, id: idProps, autoFocus, ...props }, ref)=>{
|
|
6
13
|
const id = useId(idProps);
|
|
7
14
|
const inputRef = useRef(null);
|
|
8
15
|
useEffect(()=>{
|
|
@@ -15,39 +22,18 @@ const TextInput = /*#__PURE__*/ forwardRef(({ disabled, required, readonly, plac
|
|
|
15
22
|
}, [
|
|
16
23
|
autoFocus
|
|
17
24
|
]);
|
|
18
|
-
const
|
|
19
|
-
'text',
|
|
20
|
-
'number',
|
|
21
|
-
'password',
|
|
22
|
-
'datetime-local'
|
|
23
|
-
];
|
|
24
|
-
const innerType = type && supported.includes(type) ? type : 'text';
|
|
25
|
+
const innerType = type && SUPPORTED_INPUT_TYPES.includes(type) ? type : 'text';
|
|
25
26
|
const labelClasses = classnames('fwe-input-text', {
|
|
26
27
|
'fwe-input-text-icon': icon
|
|
27
28
|
}, labelClassName);
|
|
28
|
-
const hintClasses = classnames('fwe-input-text-info');
|
|
29
|
-
function handleChange(e) {
|
|
30
|
-
if (props.onChange) props.onChange(e);
|
|
31
|
-
}
|
|
32
29
|
return /*#__PURE__*/ jsxs("label", {
|
|
33
30
|
className: labelClasses,
|
|
34
31
|
htmlFor: id,
|
|
35
32
|
ref: ref,
|
|
36
33
|
children: [
|
|
37
34
|
/*#__PURE__*/ jsx("input", {
|
|
38
|
-
name: name,
|
|
39
|
-
disabled: disabled,
|
|
40
|
-
required: required,
|
|
41
35
|
readOnly: readonly,
|
|
42
|
-
placeholder: placeholder,
|
|
43
36
|
autoComplete: "off",
|
|
44
|
-
min: min,
|
|
45
|
-
max: max,
|
|
46
|
-
step: step,
|
|
47
|
-
onChange: handleChange,
|
|
48
|
-
onBlur: onBlur,
|
|
49
|
-
onFocus: onFocus,
|
|
50
|
-
onInput: onInput,
|
|
51
37
|
type: innerType,
|
|
52
38
|
value: value,
|
|
53
39
|
defaultValue: defaultValue,
|
|
@@ -61,7 +47,7 @@ const TextInput = /*#__PURE__*/ forwardRef(({ disabled, required, readonly, plac
|
|
|
61
47
|
children: label
|
|
62
48
|
}),
|
|
63
49
|
hint && /*#__PURE__*/ jsx("span", {
|
|
64
|
-
className:
|
|
50
|
+
className: "fwe-input-text-info",
|
|
65
51
|
children: hint
|
|
66
52
|
}),
|
|
67
53
|
error && /*#__PURE__*/ jsx("span", {
|
package/package.json
CHANGED