armtek-uikit-react 1.0.266 → 1.0.267
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/assets/Accordion.scss +123 -123
- package/assets/Adornment.scss +22 -22
- package/assets/Alert.scss +56 -56
- package/assets/Avatar.scss +111 -111
- package/assets/AvatarGroup.scss +47 -47
- package/assets/BackDrop.scss +39 -39
- package/assets/Badge.scss +96 -96
- package/assets/Button.scss +750 -750
- package/assets/ButtonGroup.scss +37 -37
- package/assets/ButtonIcon.scss +59 -59
- package/assets/Card.scss +13 -13
- package/assets/Checkbox.scss +313 -313
- package/assets/Chip.scss +327 -327
- package/assets/DateField.scss +2 -2
- package/assets/DatePicker.scss +72 -72
- package/assets/Dropdown.scss +42 -42
- package/assets/FormControls.scss +14 -14
- package/assets/HelperText.scss +11 -11
- package/assets/Icon.scss +30 -30
- package/assets/Interval.scss +34 -34
- package/assets/Link.scss +96 -96
- package/assets/ListItem.scss +76 -76
- package/assets/Loader.scss +56 -56
- package/assets/Logo.scss +28 -28
- package/assets/Modal.scss +103 -103
- package/assets/Pagination.scss +3 -3
- package/assets/Paper.scss +22 -22
- package/assets/Period.scss +8 -8
- package/assets/Popper.scss +2 -2
- package/assets/Rating.scss +26 -26
- package/assets/Select.scss +85 -85
- package/assets/Skeleton.scss +25 -25
- package/assets/Slider.scss +5 -5
- package/assets/Stack.scss +27 -27
- package/assets/Status.scss +69 -69
- package/assets/StepItem.scss +89 -89
- package/assets/StepItemIcon.scss +47 -47
- package/assets/Stepper.scss +30 -30
- package/assets/Switch.scss +67 -67
- package/assets/Table.scss +52 -52
- package/assets/TextArea.scss +23 -23
- package/assets/TextField.scss +209 -206
- package/assets/Tooltip.scss +17 -17
- package/assets/classes.scss +422 -422
- package/assets/fonts.scss +24 -24
- package/assets/global.scss +222 -222
- package/assets/styles.min.css +1 -1
- package/assets/styles.min.css.map +1 -1
- package/assets/styles.scss +46 -46
- package/assets/variables.scss +13 -13
- package/lib/hooks/useEnhancedEffect.js +6 -6
- package/lib/hooks/useTimeout.js +2 -2
- package/package.json +1 -1
- package/ui/Form/DateField/DateField.js +2 -2
- package/ui/Form/DatePicker/styles.css +802 -802
- package/ui/Form/TextField/TextField.d.ts +1 -0
- package/ui/Form/TextField/TextField.js +53 -1
- package/ui/Slider/style.scss +346 -346
|
@@ -61,5 +61,6 @@ export declare const TextFieldInput: import("react").ForwardRefExoticComponent<{
|
|
|
61
61
|
label?: string;
|
|
62
62
|
wrapperClass?: string;
|
|
63
63
|
WrapperProps?: ComponentPropsWithoutRef<"div">;
|
|
64
|
+
disableLabelTransition?: boolean;
|
|
64
65
|
} & Omit<InputHTMLAttributes<any>, "size"> & import("react").RefAttributes<unknown>>;
|
|
65
66
|
export default TextField;
|
|
@@ -12,6 +12,11 @@ var _Icon = require("../../Icon");
|
|
|
12
12
|
var _Tooltip = _interopRequireDefault(require("../../Tooltip"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const LABEL_TRANSITION_RESTORE_TIMEOUT = 100;
|
|
16
|
+
const hasInputValue = value => {
|
|
17
|
+
if (value === undefined || value === null) return false;
|
|
18
|
+
return String(value).length > 0;
|
|
19
|
+
};
|
|
15
20
|
const TextField = exports.TextField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
16
21
|
var _inputRef$current;
|
|
17
22
|
let {
|
|
@@ -31,8 +36,18 @@ const TextField = exports.TextField = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
31
36
|
WrapperProps,
|
|
32
37
|
...inputProps
|
|
33
38
|
} = props;
|
|
34
|
-
let [focused, setFocused] = (0, _react.useState)(
|
|
39
|
+
let [focused, setFocused] = (0, _react.useState)(hasInputValue(props.defaultValue) || hasInputValue(props.value));
|
|
40
|
+
let [disableLabelTransition, setDisableLabelTransition] = (0, _react.useState)(false);
|
|
41
|
+
const restoreLabelTransitionTimeoutRef = (0, _react.useRef)(null);
|
|
35
42
|
const inputRef = (0, _react.useRef)(null);
|
|
43
|
+
const temporarilyDisableLabelTransition = () => {
|
|
44
|
+
setDisableLabelTransition(true);
|
|
45
|
+
if (restoreLabelTransitionTimeoutRef.current !== null) window.clearTimeout(restoreLabelTransitionTimeoutRef.current);
|
|
46
|
+
restoreLabelTransitionTimeoutRef.current = window.setTimeout(() => {
|
|
47
|
+
setDisableLabelTransition(false);
|
|
48
|
+
restoreLabelTransitionTimeoutRef.current = null;
|
|
49
|
+
}, LABEL_TRANSITION_RESTORE_TIMEOUT);
|
|
50
|
+
};
|
|
36
51
|
const currentScrollHeight = (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.scrollHeight;
|
|
37
52
|
(0, _react.useImperativeHandle)(ref, () => {
|
|
38
53
|
return inputRef.current;
|
|
@@ -47,6 +62,40 @@ const TextField = exports.TextField = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
47
62
|
// }
|
|
48
63
|
// }
|
|
49
64
|
}, [currentScrollHeight]);
|
|
65
|
+
(0, _react.useEffect)(() => {
|
|
66
|
+
return () => {
|
|
67
|
+
if (restoreLabelTransitionTimeoutRef.current !== null) window.clearTimeout(restoreLabelTransitionTimeoutRef.current);
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
(0, _react.useLayoutEffect)(() => {
|
|
71
|
+
var _valueDescriptor$enum;
|
|
72
|
+
const inputElement = inputRef.current;
|
|
73
|
+
if (!inputElement) return;
|
|
74
|
+
const prototype = inputElement instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
75
|
+
const valueDescriptor = Object.getOwnPropertyDescriptor(prototype, 'value');
|
|
76
|
+
const syncFocusedState = () => {
|
|
77
|
+
setFocused(hasInputValue(inputElement.value));
|
|
78
|
+
};
|
|
79
|
+
syncFocusedState();
|
|
80
|
+
if (!(valueDescriptor != null && valueDescriptor.get) || !(valueDescriptor != null && valueDescriptor.set)) return;
|
|
81
|
+
Object.defineProperty(inputElement, 'value', {
|
|
82
|
+
configurable: true,
|
|
83
|
+
enumerable: (_valueDescriptor$enum = valueDescriptor.enumerable) != null ? _valueDescriptor$enum : true,
|
|
84
|
+
get() {
|
|
85
|
+
var _valueDescriptor$get;
|
|
86
|
+
return (_valueDescriptor$get = valueDescriptor.get) == null ? void 0 : _valueDescriptor$get.call(this);
|
|
87
|
+
},
|
|
88
|
+
set(nextValue) {
|
|
89
|
+
var _valueDescriptor$set;
|
|
90
|
+
(_valueDescriptor$set = valueDescriptor.set) == null || _valueDescriptor$set.call(this, nextValue);
|
|
91
|
+
temporarilyDisableLabelTransition();
|
|
92
|
+
syncFocusedState();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return () => {
|
|
96
|
+
Reflect.deleteProperty(inputElement, 'value');
|
|
97
|
+
};
|
|
98
|
+
}, [multiline]);
|
|
50
99
|
const handleFocus = e => {
|
|
51
100
|
setFocused(true);
|
|
52
101
|
if (inputProps.onFocus) inputProps.onFocus(e);
|
|
@@ -106,6 +155,7 @@ const TextField = exports.TextField = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
106
155
|
variant: variant,
|
|
107
156
|
label: label,
|
|
108
157
|
focused: realFocused,
|
|
158
|
+
disableLabelTransition: disableLabelTransition,
|
|
109
159
|
error: error,
|
|
110
160
|
multiline: multiline,
|
|
111
161
|
...inputProps,
|
|
@@ -162,6 +212,7 @@ const TextFieldInput = exports.TextFieldInput = /*#__PURE__*/(0, _react.forwardR
|
|
|
162
212
|
label,
|
|
163
213
|
wrapperClass,
|
|
164
214
|
WrapperProps,
|
|
215
|
+
disableLabelTransition,
|
|
165
216
|
className,
|
|
166
217
|
onInput,
|
|
167
218
|
...inputProps
|
|
@@ -229,6 +280,7 @@ const TextFieldInput = exports.TextFieldInput = /*#__PURE__*/(0, _react.forwardR
|
|
|
229
280
|
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
230
281
|
className: (0, _clsx.default)('arm-textfield__label', {
|
|
231
282
|
'arm-textfield__label_focused': focused || !!props.value || typeof ((_inputElementRef$curr = inputElementRef.current) == null ? void 0 : _inputElementRef$curr.value) === 'string' && !!((_inputElementRef$curr2 = inputElementRef.current) != null && _inputElementRef$curr2.value),
|
|
283
|
+
'arm-textfield__label_noTransition': disableLabelTransition,
|
|
232
284
|
'arm-textfield__label_small': size === 'small',
|
|
233
285
|
'arm-textfield__label_error': error
|
|
234
286
|
}),
|