linear-react-components-ui 1.1.25-beta.6 → 1.1.25-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{BaseMask-78847f45.d.ts → BaseMask-0c14ef51.d.ts} +1 -1
- package/lib/{Cnpj-8366781f.d.ts → Cnpj-53bfd6ab.d.ts} +2 -1
- package/lib/{Cpf-3dfd54eb.d.ts → Cpf-019b21e0.d.ts} +2 -1
- package/lib/{Phone-1962c0f2.d.ts → Phone-2bb0b397.d.ts} +1 -1
- package/lib/{ZipCode-be9c5b3b.d.ts → ZipCode-09460e18.d.ts} +1 -1
- package/lib/index-19761a50.d.ts +26 -0
- package/lib/{index-6fcf446c.d.ts → index-208e7f62.d.ts} +20 -2
- package/lib/{index-02a27c19.d.ts → index-3b70931d.d.ts} +20 -2
- package/lib/index-4bda404f.d.ts +42 -0
- package/lib/{index-25b80f32.d.ts → index-7dfa8924.d.ts} +1 -1
- package/lib/{index-6f5c772d.d.ts → index-9e576346.d.ts} +1 -1
- package/lib/{index-696662fe.d.ts → index-afb7b5a9.d.ts} +1 -1
- package/lib/inputs2/checkboxfield/index.d.ts +2 -3
- package/lib/inputs2/checkboxfield/index.js +125 -32
- package/lib/inputs2/colorfield/index.d.ts +5 -6
- package/lib/inputs2/date/datefield/index.js +322 -34
- package/lib/inputs2/date/datefield/types.d.ts +3 -5
- package/lib/inputs2/date/dateperiodfield/index.js +587 -34
- package/lib/inputs2/date/dateperiodfield/types.d.ts +3 -5
- package/lib/inputs2/filefield/index.d.ts +5 -6
- package/lib/inputs2/index.d.ts +15 -18
- package/lib/inputs2/mask/BaseMask.d.ts +5 -6
- package/lib/inputs2/mask/Cnpj.d.ts +6 -7
- package/lib/inputs2/mask/Cnpj.js +21 -18
- package/lib/inputs2/mask/Cpf.d.ts +6 -7
- package/lib/inputs2/mask/Cpf.js +19 -12
- package/lib/inputs2/mask/Phone.d.ts +6 -7
- package/lib/inputs2/mask/ZipCode.d.ts +6 -7
- package/lib/inputs2/numberfield/currency.d.ts +4 -5
- package/lib/inputs2/numberfield/decimal.d.ts +4 -5
- package/lib/inputs2/numberfield/index.d.ts +4 -5
- package/lib/inputs2/numberfield/types.d.ts +4 -5
- package/lib/inputs2/radiofield/index.d.ts +1 -1
- package/lib/inputs2/radiofield/index.js +126 -25
- package/lib/inputs2/radiofield/types.d.ts +4 -6
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.js +502 -35
- package/lib/inputs2/selectfield/types.d.ts +6 -8
- package/lib/inputs2/textareafield/index.d.ts +3 -4
- package/lib/inputs2/textareafield/index.js +154 -30
- package/lib/inputs2/textfield/index.d.ts +4 -5
- package/lib/inputs2/textfield/index.js +120 -30
- package/package.json +1 -1
- package/lib/index-053f615b.d.ts +0 -26
- package/lib/index-7159df18.d.ts +0 -21
- package/lib/inputs2/checkboxfield/base.d.ts +0 -29
- package/lib/inputs2/checkboxfield/base.js +0 -134
- package/lib/inputs2/date/datefield/base.d.ts +0 -13
- package/lib/inputs2/date/datefield/base.js +0 -330
- package/lib/inputs2/date/dateperiodfield/base.d.ts +0 -13
- package/lib/inputs2/date/dateperiodfield/base.js +0 -595
- package/lib/inputs2/radiofield/base.d.ts +0 -12
- package/lib/inputs2/radiofield/base.js +0 -156
- package/lib/inputs2/selectfield/base.d.ts +0 -11
- package/lib/inputs2/selectfield/base.js +0 -513
- package/lib/inputs2/textareafield/base.d.ts +0 -26
- package/lib/inputs2/textareafield/base.js +0 -166
- package/lib/inputs2/textfield/base.d.ts +0 -26
- package/lib/inputs2/textfield/base.js +0 -131
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InputBase = void 0;
|
|
7
|
-
require("../../assets/styles/textfield.scss");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
-
var _hint = _interopRequireDefault(require("../../hint"));
|
|
11
|
-
var _tooltip = require("../../tooltip");
|
|
12
|
-
var _textContent = _interopRequireDefault(require("../../textContent"));
|
|
13
|
-
var _helpers = require("../../form2/helpers");
|
|
14
|
-
var _popover = _interopRequireWildcard(require("../../popover"));
|
|
15
|
-
var _slot = require("../slot");
|
|
16
|
-
const _excluded = ["name", "label", "errors", "children", "maxLength", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "textAlign", "labelUppercase", "skeletonize", "hintPosition", "themePopover", "popoverAlign", "tooltip", "tooltipPosition", "tooltipWidth", "hint", "disabled", "readOnly"];
|
|
17
|
-
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); }
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
22
|
-
const InputBase = exports.InputBase = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
23
|
-
var _props$hint;
|
|
24
|
-
const {
|
|
25
|
-
name,
|
|
26
|
-
label,
|
|
27
|
-
errors,
|
|
28
|
-
children,
|
|
29
|
-
maxLength = undefined,
|
|
30
|
-
customClass = '',
|
|
31
|
-
customClassLabel = '',
|
|
32
|
-
customClassWrapper = '',
|
|
33
|
-
customClassInputContainer = '',
|
|
34
|
-
textAlign = 'left',
|
|
35
|
-
labelUppercase = false,
|
|
36
|
-
skeletonize = false,
|
|
37
|
-
hintPosition = 'below',
|
|
38
|
-
themePopover = 'light',
|
|
39
|
-
popoverAlign = 'left',
|
|
40
|
-
tooltip,
|
|
41
|
-
tooltipPosition,
|
|
42
|
-
tooltipWidth,
|
|
43
|
-
hint,
|
|
44
|
-
disabled,
|
|
45
|
-
readOnly
|
|
46
|
-
} = props,
|
|
47
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
48
|
-
const inputRef = _react.default.useRef(null);
|
|
49
|
-
const counterRef = _react.default.useRef(null);
|
|
50
|
-
const textAreaInternalRef = _react.default.useRef(null);
|
|
51
|
-
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
52
|
-
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
53
|
-
const hintMustBeOnLabel = hintPosition === 'onLabelRight';
|
|
54
|
-
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
55
|
-
const hasMaxLengthCondition = Boolean(maxLength);
|
|
56
|
-
const {
|
|
57
|
-
leftSlotElements,
|
|
58
|
-
rightSlotElements
|
|
59
|
-
} = _react.default.useMemo(() => {
|
|
60
|
-
const left = [];
|
|
61
|
-
const right = [];
|
|
62
|
-
_react.default.Children.map(children, (childElement, index) => {
|
|
63
|
-
if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
|
|
64
|
-
var _childElement$key;
|
|
65
|
-
const clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
|
|
66
|
-
key: (_childElement$key = childElement.key) !== null && _childElement$key !== void 0 ? _childElement$key : "slot-".concat(index),
|
|
67
|
-
disabled: disabled,
|
|
68
|
-
'aria-disabled': disabled
|
|
69
|
-
});
|
|
70
|
-
if (childElement.type === _slot.LeftSlot) left.push(clonedChild);
|
|
71
|
-
if (childElement.type === _slot.RightSlot) right.push(clonedChild);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return {
|
|
75
|
-
leftSlotElements: left,
|
|
76
|
-
rightSlotElements: right
|
|
77
|
-
};
|
|
78
|
-
}, [children, disabled]);
|
|
79
|
-
const hasLeftSlotElements = Boolean(leftSlotElements === null || leftSlotElements === void 0 ? void 0 : leftSlotElements.length);
|
|
80
|
-
const hasRightSlotElements = Boolean(rightSlotElements === null || rightSlotElements === void 0 ? void 0 : rightSlotElements.length);
|
|
81
|
-
const handleOnInputData = event => {
|
|
82
|
-
const target = event.target;
|
|
83
|
-
const currentLength = target.value.length;
|
|
84
|
-
if (counterRef.current) {
|
|
85
|
-
counterRef.current.textContent = "".concat(currentLength, "/").concat(maxLength);
|
|
86
|
-
/**
|
|
87
|
-
* Cálculo faz referência ao tamanho do espaço ocupado do contador de caracteres.
|
|
88
|
-
* Isso evita quebra de layout da interface.
|
|
89
|
-
*/
|
|
90
|
-
counterRef.current.style.width = "".concat(_lodash.default.toNumber(maxLength === null || maxLength === void 0 ? void 0 : maxLength.toString().length) * 7 * 2 + 6, "px");
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
_react.default.useEffect(() => {
|
|
94
|
-
var _textAreaInternalRef$;
|
|
95
|
-
textAreaInternalRef === null || textAreaInternalRef === void 0 ? void 0 : (_textAreaInternalRef$ = textAreaInternalRef.current) === null || _textAreaInternalRef$ === void 0 ? void 0 : _textAreaInternalRef$.addEventListener('input', handleOnInputData);
|
|
96
|
-
return () => {
|
|
97
|
-
var _textAreaInternalRef$2;
|
|
98
|
-
textAreaInternalRef === null || textAreaInternalRef === void 0 ? void 0 : (_textAreaInternalRef$2 = textAreaInternalRef.current) === null || _textAreaInternalRef$2 === void 0 ? void 0 : _textAreaInternalRef$2.removeEventListener('input', handleOnInputData);
|
|
99
|
-
};
|
|
100
|
-
}, []);
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
-
ref: inputRef,
|
|
103
|
-
className: "text-field-root ".concat(customClassWrapper),
|
|
104
|
-
"data-state-error": hasValidationErrors
|
|
105
|
-
}, hasLabel && /*#__PURE__*/_react.default.createElement("span", {
|
|
106
|
-
className: "root-label ".concat(customClassLabel),
|
|
107
|
-
"data-state-skeletonize": skeletonize
|
|
108
|
-
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
109
|
-
className: "label",
|
|
110
|
-
title: label,
|
|
111
|
-
htmlFor: name,
|
|
112
|
-
"data-state-disabled": disabled,
|
|
113
|
-
"data-state-read-only": readOnly,
|
|
114
|
-
"data-state-input-required": props.required,
|
|
115
|
-
"data-state-label-uppercase": labelUppercase
|
|
116
|
-
}, label), hint && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
117
|
-
customClass: "label-popover",
|
|
118
|
-
theme: themePopover,
|
|
119
|
-
align: popoverAlign,
|
|
120
|
-
iconColor: "#03bde2"
|
|
121
|
-
}, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
|
|
122
|
-
text: hint
|
|
123
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
-
"data-state-skeletonize": skeletonize,
|
|
125
|
-
className: "container ".concat(customClassInputContainer)
|
|
126
|
-
}, hasLeftSlotElements && !skeletonize && leftSlotElements, /*#__PURE__*/_react.default.createElement("textarea", _extends({
|
|
127
|
-
ref: (0, _helpers.mergeRefs)(ref, textAreaInternalRef),
|
|
128
|
-
id: name,
|
|
129
|
-
readOnly: readOnly,
|
|
130
|
-
disabled: disabled,
|
|
131
|
-
maxLength: maxLength,
|
|
132
|
-
className: "input ".concat(customClass),
|
|
133
|
-
tabIndex: !readOnly ? 0 : -1,
|
|
134
|
-
placeholder: rest.placeholder,
|
|
135
|
-
"data-state-error": hasValidationErrors,
|
|
136
|
-
"data-state-read-only": readOnly,
|
|
137
|
-
"data-state-text-align": textAlign,
|
|
138
|
-
"data-state-skeletonize": skeletonize
|
|
139
|
-
}, rest)), hasRightSlotElements && !skeletonize && rightSlotElements), /*#__PURE__*/_react.default.createElement("div", {
|
|
140
|
-
className: "footer",
|
|
141
|
-
"data-state-has-max-length": hasMaxLengthCondition,
|
|
142
|
-
"data-state-has-hint": hasHintMessages && !hintMustBeOnLabel
|
|
143
|
-
}, /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
144
|
-
customClass: "hint",
|
|
145
|
-
description: hint,
|
|
146
|
-
disabled: disabled,
|
|
147
|
-
skeletonize: skeletonize,
|
|
148
|
-
visible: !hintMustBeOnLabel && hasHintMessages
|
|
149
|
-
}), hasMaxLengthCondition && /*#__PURE__*/_react.default.createElement(_textContent.default, {
|
|
150
|
-
ref: counterRef,
|
|
151
|
-
as: "span",
|
|
152
|
-
className: "max-length-counter"
|
|
153
|
-
}, "0/", _lodash.default.toNumber(maxLength))), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
|
|
154
|
-
className: "error",
|
|
155
|
-
"data-state-skeletonize": skeletonize,
|
|
156
|
-
"aria-describedby": String(name).concat('-errors')
|
|
157
|
-
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
158
|
-
key: "".concat(index + 1, "-").concat(error)
|
|
159
|
-
}, error, "\xA0")))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
160
|
-
targetRef: inputRef,
|
|
161
|
-
text: tooltip,
|
|
162
|
-
width: tooltipWidth,
|
|
163
|
-
position: tooltipPosition
|
|
164
|
-
}));
|
|
165
|
-
});
|
|
166
|
-
InputBase.displayName = 'TextAreaFieldInputBase';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { ITooltipCommonProps } from '../../tooltip/types.js';
|
|
3
|
-
import { TextAlign } from '../../@types/Align.js';
|
|
4
|
-
import { ColorTheme } from '../../@types/ColorStyles.js';
|
|
5
|
-
import { HintPosition, Position } from '../../@types/Position.js';
|
|
6
|
-
|
|
7
|
-
interface TextFieldInputBaseProps extends React__default.ComponentPropsWithoutRef<'input'>, ITooltipCommonProps {
|
|
8
|
-
hint?: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
errors?: string[];
|
|
11
|
-
customClass?: string;
|
|
12
|
-
customClassLabel?: string;
|
|
13
|
-
customClassWrapper?: string;
|
|
14
|
-
customClassInputContainer?: string;
|
|
15
|
-
rounded?: boolean;
|
|
16
|
-
readOnly?: boolean;
|
|
17
|
-
skeletonize?: boolean;
|
|
18
|
-
labelUppercase?: boolean;
|
|
19
|
-
textAlign?: TextAlign;
|
|
20
|
-
hintPosition?: HintPosition;
|
|
21
|
-
themePopover?: ColorTheme;
|
|
22
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
23
|
-
}
|
|
24
|
-
declare const InputBase: React__default.ForwardRefExoticComponent<TextFieldInputBaseProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
25
|
-
|
|
26
|
-
export { InputBase, TextFieldInputBaseProps };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InputBase = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
var _tooltip = require("../../tooltip");
|
|
10
|
-
var _popover = _interopRequireWildcard(require("../../popover"));
|
|
11
|
-
var _hint = _interopRequireDefault(require("../../hint"));
|
|
12
|
-
var _slot = require("../slot");
|
|
13
|
-
const _excluded = ["type", "name", "label", "errors", "children", "disabled", "readOnly", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "textAlign", "labelUppercase", "skeletonize", "hintPosition", "themePopover", "popoverAlign", "tooltip", "tooltipPosition", "tooltipWidth", "hint"];
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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); }
|
|
16
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
19
|
-
const InputBase = exports.InputBase = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
20
|
-
var _props$hint;
|
|
21
|
-
const {
|
|
22
|
-
type = 'text',
|
|
23
|
-
name,
|
|
24
|
-
label,
|
|
25
|
-
errors,
|
|
26
|
-
children,
|
|
27
|
-
disabled,
|
|
28
|
-
readOnly,
|
|
29
|
-
customClass = '',
|
|
30
|
-
customClassLabel = '',
|
|
31
|
-
customClassWrapper = '',
|
|
32
|
-
customClassInputContainer = '',
|
|
33
|
-
textAlign = 'left',
|
|
34
|
-
labelUppercase = false,
|
|
35
|
-
skeletonize = false,
|
|
36
|
-
hintPosition = 'below',
|
|
37
|
-
themePopover = 'light',
|
|
38
|
-
popoverAlign = 'left',
|
|
39
|
-
tooltip,
|
|
40
|
-
tooltipPosition,
|
|
41
|
-
tooltipWidth,
|
|
42
|
-
hint
|
|
43
|
-
} = props,
|
|
44
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
45
|
-
const inputRef = (0, _react.useRef)(null);
|
|
46
|
-
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
47
|
-
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
48
|
-
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
49
|
-
const {
|
|
50
|
-
leftSlotElements,
|
|
51
|
-
rightSlotElements
|
|
52
|
-
} = _react.default.useMemo(() => {
|
|
53
|
-
const left = [];
|
|
54
|
-
const right = [];
|
|
55
|
-
_react.default.Children.map(children, (childElement, index) => {
|
|
56
|
-
if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
|
|
57
|
-
var _childElement$key;
|
|
58
|
-
const clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
|
|
59
|
-
key: (_childElement$key = childElement.key) !== null && _childElement$key !== void 0 ? _childElement$key : "slot-".concat(index),
|
|
60
|
-
disabled: disabled,
|
|
61
|
-
'aria-disabled': disabled
|
|
62
|
-
});
|
|
63
|
-
if (childElement.type === _slot.LeftSlot) left.push(clonedChild);
|
|
64
|
-
if (childElement.type === _slot.RightSlot) right.push(clonedChild);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
leftSlotElements: left,
|
|
69
|
-
rightSlotElements: right
|
|
70
|
-
};
|
|
71
|
-
}, [children, disabled]);
|
|
72
|
-
const hasLeftSlotElements = Boolean(leftSlotElements === null || leftSlotElements === void 0 ? void 0 : leftSlotElements.length);
|
|
73
|
-
const hasRightSlotElements = Boolean(rightSlotElements === null || rightSlotElements === void 0 ? void 0 : rightSlotElements.length);
|
|
74
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
ref: inputRef,
|
|
76
|
-
className: "text-field-root ".concat(customClassWrapper),
|
|
77
|
-
"data-state-error": hasValidationErrors
|
|
78
|
-
}, hasLabel && /*#__PURE__*/_react.default.createElement("span", {
|
|
79
|
-
className: "root-label ".concat(customClassLabel),
|
|
80
|
-
"data-state-skeletonize": skeletonize
|
|
81
|
-
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
82
|
-
className: "label",
|
|
83
|
-
title: label,
|
|
84
|
-
htmlFor: name,
|
|
85
|
-
"data-state-disabled": disabled,
|
|
86
|
-
"data-state-read-only": readOnly,
|
|
87
|
-
"data-state-input-required": props.required,
|
|
88
|
-
"data-state-label-uppercase": labelUppercase
|
|
89
|
-
}, label), hint && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
90
|
-
customClass: "label-popover",
|
|
91
|
-
theme: themePopover,
|
|
92
|
-
align: popoverAlign,
|
|
93
|
-
iconColor: "#03bde2"
|
|
94
|
-
}, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
|
|
95
|
-
text: hint
|
|
96
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
-
"data-state-skeletonize": skeletonize,
|
|
98
|
-
className: "container ".concat(customClassInputContainer)
|
|
99
|
-
}, hasLeftSlotElements && !skeletonize && leftSlotElements, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
100
|
-
ref: ref,
|
|
101
|
-
id: name,
|
|
102
|
-
type: type,
|
|
103
|
-
readOnly: readOnly,
|
|
104
|
-
disabled: disabled,
|
|
105
|
-
className: "input ".concat(customClass),
|
|
106
|
-
tabIndex: !readOnly ? 0 : -1,
|
|
107
|
-
placeholder: rest.placeholder,
|
|
108
|
-
"data-state-error": hasValidationErrors,
|
|
109
|
-
"data-state-read-only": readOnly,
|
|
110
|
-
"data-state-text-align": textAlign,
|
|
111
|
-
"data-state-skeletonize": skeletonize
|
|
112
|
-
}, rest)), hasRightSlotElements && !skeletonize && rightSlotElements), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
113
|
-
customClass: "hint",
|
|
114
|
-
description: hint,
|
|
115
|
-
disabled: disabled,
|
|
116
|
-
skeletonize: skeletonize,
|
|
117
|
-
visible: hasHintMessages
|
|
118
|
-
}), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
|
|
119
|
-
className: "error",
|
|
120
|
-
"data-state-skeletonize": skeletonize,
|
|
121
|
-
"aria-describedby": String(name).concat('-errors')
|
|
122
|
-
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
123
|
-
key: "".concat(index + 1, "-").concat(error)
|
|
124
|
-
}, error, "\xA0")))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
125
|
-
targetRef: inputRef,
|
|
126
|
-
text: tooltip,
|
|
127
|
-
width: tooltipWidth,
|
|
128
|
-
position: tooltipPosition
|
|
129
|
-
}));
|
|
130
|
-
});
|
|
131
|
-
InputBase.displayName = 'TextFieldInputBase';
|