@elastic/eui 116.3.1-snapshot.1782222821728 → 116.4.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/es/components/date_picker/date_picker.js +1 -1
- package/es/components/form/field_password/field_password.styles.js +1 -1
- package/es/components/form/field_search/field_search.styles.js +1 -1
- package/es/components/form/form.styles.js +1 -1
- package/es/components/form/select/select.styles.js +1 -1
- package/es/components/form/text_area/text_area.styles.js +1 -1
- package/es/components/form/validatable_control/validatable_control.js +55 -8
- package/eui.d.ts +48 -54
- package/i18ntokens.json +970 -988
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/form/field_password/field_password.styles.js +1 -1
- package/lib/components/form/field_search/field_search.styles.js +1 -1
- package/lib/components/form/form.styles.js +1 -1
- package/lib/components/form/select/select.styles.js +1 -1
- package/lib/components/form/text_area/text_area.styles.js +1 -1
- package/lib/components/form/validatable_control/validatable_control.js +52 -7
- package/optimize/es/components/date_picker/date_picker.js +1 -1
- package/optimize/es/components/form/field_password/field_password.styles.js +1 -1
- package/optimize/es/components/form/field_search/field_search.styles.js +1 -1
- package/optimize/es/components/form/form.styles.js +1 -1
- package/optimize/es/components/form/select/select.styles.js +1 -1
- package/optimize/es/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/es/components/form/validatable_control/validatable_control.js +48 -7
- package/optimize/lib/components/date_picker/date_picker.js +1 -1
- package/optimize/lib/components/form/field_password/field_password.styles.js +1 -1
- package/optimize/lib/components/form/field_search/field_search.styles.js +1 -1
- package/optimize/lib/components/form/form.styles.js +1 -1
- package/optimize/lib/components/form/select/select.styles.js +1 -1
- package/optimize/lib/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/lib/components/form/validatable_control/validatable_control.js +49 -6
- package/package.json +2 -3
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/form/field_password/field_password.styles.js +1 -1
- package/test-env/components/form/field_search/field_search.styles.js +1 -1
- package/test-env/components/form/form.styles.js +1 -1
- package/test-env/components/form/select/select.styles.js +1 -1
- package/test-env/components/form/text_area/text_area.styles.js +1 -1
- package/test-env/components/form/validatable_control/validatable_control.js +48 -6
|
@@ -143,7 +143,7 @@ var EuiDatePicker = exports.EuiDatePicker = function EuiDatePicker(_ref) {
|
|
|
143
143
|
fullDateFormat = "".concat(dateFormat, " ").concat(timeFormat);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// Set an internal ref on ReactDatePicker's `input` so we can set its
|
|
146
|
+
// Set an internal ref on ReactDatePicker's `input` so we can set its :invalid state via useEuiValidatableControl
|
|
147
147
|
var _useState = (0, _react.useState)(null),
|
|
148
148
|
_useState2 = _slicedToArray(_useState, 2),
|
|
149
149
|
inputValidityRef = _useState2[0],
|
|
@@ -24,7 +24,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
24
24
|
var euiFieldPasswordStyles = exports.euiFieldPasswordStyles = function euiFieldPasswordStyles(euiThemeContext) {
|
|
25
25
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
26
26
|
return {
|
|
27
|
-
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:
|
|
27
|
+
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
|
|
28
28
|
// Only remove Edge's internal reveal button if we're providing a custom one
|
|
29
29
|
// This pseudo-element is still supported in Chromium-based Edge.
|
|
30
30
|
withToggle: _ref,
|
|
@@ -17,7 +17,7 @@ var _form = require("../form.styles");
|
|
|
17
17
|
var euiFieldSearchStyles = exports.euiFieldSearchStyles = function euiFieldSearchStyles(euiThemeContext) {
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
return {
|
|
20
|
-
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:
|
|
20
|
+
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
|
|
21
21
|
// Skip the css() on the default height to avoid generating a className
|
|
22
22
|
uncompressed: formStyles.uncompressed,
|
|
23
23
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -211,7 +211,7 @@ var euiFormControlAutoFillStyles = exports.euiFormControlAutoFillStyles = functi
|
|
|
211
211
|
var borderShadow = "inset 0 0 0 var(--euiFormControlStateAutofillWidth) var(--euiFormControlStateAutofillColor), ".concat(backgroundShadow);
|
|
212
212
|
|
|
213
213
|
// These styles only apply/override Chrome/webkit browsers - Firefox does not set autofill styles
|
|
214
|
-
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:
|
|
214
|
+
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:invalid {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
|
|
215
215
|
};
|
|
216
216
|
var euiFormControlAutofillUnsetStyles = exports.euiFormControlAutofillUnsetStyles = "\n\n";
|
|
217
217
|
var euiFormControlShowBackgroundLine = exports.euiFormControlShowBackgroundLine = function euiFormControlShowBackgroundLine(euiThemeContext, color) {
|
|
@@ -18,7 +18,7 @@ var euiSelectStyles = exports.euiSelectStyles = function euiSelectStyles(euiThem
|
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
var formVariables = (0, _form.euiFormVariables)(euiThemeContext);
|
|
20
20
|
return {
|
|
21
|
-
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:
|
|
21
|
+
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
22
22
|
// Skip the css() on the default height to avoid generating a className
|
|
23
23
|
uncompressed: formStyles.uncompressed,
|
|
24
24
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -51,7 +51,7 @@ var euiTextAreaStyles = exports.euiTextAreaStyles = function euiTextAreaStyles(e
|
|
|
51
51
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
52
52
|
var formVars = (0, _form.euiFormVariables)(euiThemeContext);
|
|
53
53
|
return {
|
|
54
|
-
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:
|
|
54
|
+
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
55
55
|
resize: {
|
|
56
56
|
vertical: _ref4,
|
|
57
57
|
horizontal: _ref3,
|
|
@@ -7,30 +7,53 @@ exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
|
|
11
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
18
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
20
|
* Side Public License, v 1.
|
|
16
21
|
*/
|
|
22
|
+
function isMutableRef(ref) {
|
|
23
|
+
return ref != null && ref.hasOwnProperty('current');
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* The `EuiValidatableControl` component should be used in scenarios where
|
|
20
28
|
* we can render the validated `<input>` as its direct child.
|
|
21
|
-
*
|
|
22
|
-
* It flags the underlying control as invalid via `aria-invalid`, which EUI form
|
|
23
|
-
* controls use to render their invalid styling. Note that it intentionally does
|
|
24
|
-
* *not* hook into the native constraint validation API (`setCustomValidity`) -
|
|
25
|
-
* `isInvalid` is a presentational prop, and tying it to native validity would
|
|
26
|
-
* block native form submission and surface a non-localized native error tooltip.
|
|
27
29
|
*/
|
|
28
30
|
|
|
29
31
|
var EuiValidatableControl = exports.EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
30
32
|
var isInvalid = _ref.isInvalid,
|
|
31
33
|
children = _ref.children;
|
|
34
|
+
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
35
|
+
var _useState = (0, _react.useState)(null),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
control = _useState2[0],
|
|
38
|
+
setControl = _useState2[1];
|
|
32
39
|
var child = _react.Children.only(children);
|
|
40
|
+
var childRef = child.ref;
|
|
41
|
+
var replacedRef = (0, _react.useCallback)(function (element) {
|
|
42
|
+
setControl(element);
|
|
43
|
+
|
|
44
|
+
// Call the original ref, if any
|
|
45
|
+
if (typeof childRef === 'function') {
|
|
46
|
+
childRef(element);
|
|
47
|
+
} else if (isMutableRef(childRef)) {
|
|
48
|
+
childRef.current = element;
|
|
49
|
+
}
|
|
50
|
+
}, [childRef]);
|
|
51
|
+
useSetControlValidity({
|
|
52
|
+
controlEl: control,
|
|
53
|
+
isInvalid: isInvalid
|
|
54
|
+
});
|
|
33
55
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
56
|
+
ref: replacedRef,
|
|
34
57
|
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
35
58
|
});
|
|
36
59
|
};
|
|
@@ -53,6 +76,10 @@ EuiValidatableControl.propTypes = {
|
|
|
53
76
|
var useEuiValidatableControl = exports.useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
54
77
|
var isInvalid = _ref2.isInvalid,
|
|
55
78
|
controlEl = _ref2.controlEl;
|
|
79
|
+
useSetControlValidity({
|
|
80
|
+
controlEl: controlEl,
|
|
81
|
+
isInvalid: isInvalid
|
|
82
|
+
});
|
|
56
83
|
(0, _react.useEffect)(function () {
|
|
57
84
|
if (!controlEl) return;
|
|
58
85
|
if (typeof isInvalid === 'boolean') {
|
|
@@ -61,4 +88,22 @@ var useEuiValidatableControl = exports.useEuiValidatableControl = function useEu
|
|
|
61
88
|
controlEl.removeAttribute('aria-invalid');
|
|
62
89
|
}
|
|
63
90
|
}, [isInvalid, controlEl]);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Internal `setCustomValidity` helper
|
|
95
|
+
*/
|
|
96
|
+
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
97
|
+
var controlEl = _ref3.controlEl,
|
|
98
|
+
isInvalid = _ref3.isInvalid;
|
|
99
|
+
(0, _react.useEffect)(function () {
|
|
100
|
+
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (isInvalid) {
|
|
104
|
+
controlEl.setCustomValidity('Invalid');
|
|
105
|
+
} else {
|
|
106
|
+
controlEl.setCustomValidity('');
|
|
107
|
+
}
|
|
108
|
+
}, [isInvalid, controlEl]);
|
|
64
109
|
};
|
|
@@ -124,7 +124,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
|
|
|
124
124
|
fullDateFormat = "".concat(dateFormat, " ").concat(timeFormat);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
// Set an internal ref on ReactDatePicker's `input` so we can set its
|
|
127
|
+
// Set an internal ref on ReactDatePicker's `input` so we can set its :invalid state via useEuiValidatableControl
|
|
128
128
|
var _useState = useState(null),
|
|
129
129
|
_useState2 = _slicedToArray(_useState, 2),
|
|
130
130
|
inputValidityRef = _useState2[0],
|
|
@@ -20,7 +20,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
20
|
export var euiFieldPasswordStyles = function euiFieldPasswordStyles(euiThemeContext) {
|
|
21
21
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
22
22
|
return {
|
|
23
|
-
euiFieldPassword: /*#__PURE__*/css(formStyles.shared, " &:
|
|
23
|
+
euiFieldPassword: /*#__PURE__*/css(formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
|
|
24
24
|
// Only remove Edge's internal reveal button if we're providing a custom one
|
|
25
25
|
// This pseudo-element is still supported in Chromium-based Edge.
|
|
26
26
|
withToggle: _ref,
|
|
@@ -11,7 +11,7 @@ import { euiFormControlStyles } from '../form.styles';
|
|
|
11
11
|
export var euiFieldSearchStyles = function euiFieldSearchStyles(euiThemeContext) {
|
|
12
12
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
13
13
|
return {
|
|
14
|
-
euiFieldSearch: /*#__PURE__*/css("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:
|
|
14
|
+
euiFieldSearch: /*#__PURE__*/css("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
|
|
15
15
|
// Skip the css() on the default height to avoid generating a className
|
|
16
16
|
uncompressed: formStyles.uncompressed,
|
|
17
17
|
compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
|
|
@@ -205,7 +205,7 @@ export var euiFormControlAutoFillStyles = function euiFormControlAutoFillStyles(
|
|
|
205
205
|
var borderShadow = "inset 0 0 0 var(--euiFormControlStateAutofillWidth) var(--euiFormControlStateAutofillColor), ".concat(backgroundShadow);
|
|
206
206
|
|
|
207
207
|
// These styles only apply/override Chrome/webkit browsers - Firefox does not set autofill styles
|
|
208
|
-
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:
|
|
208
|
+
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:invalid {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
|
|
209
209
|
};
|
|
210
210
|
export var euiFormControlAutofillUnsetStyles = "\n\n";
|
|
211
211
|
export var euiFormControlShowBackgroundLine = function euiFormControlShowBackgroundLine(euiThemeContext, color) {
|
|
@@ -12,7 +12,7 @@ export var euiSelectStyles = function euiSelectStyles(euiThemeContext) {
|
|
|
12
12
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
13
13
|
var formVariables = euiFormVariables(euiThemeContext);
|
|
14
14
|
return {
|
|
15
|
-
euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:
|
|
15
|
+
euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
16
16
|
// Skip the css() on the default height to avoid generating a className
|
|
17
17
|
uncompressed: formStyles.uncompressed,
|
|
18
18
|
compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
|
|
@@ -47,7 +47,7 @@ export var euiTextAreaStyles = function euiTextAreaStyles(euiThemeContext) {
|
|
|
47
47
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
48
48
|
var formVars = euiFormVariables(euiThemeContext);
|
|
49
49
|
return {
|
|
50
|
-
euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:
|
|
50
|
+
euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
51
51
|
resize: {
|
|
52
52
|
vertical: _ref4,
|
|
53
53
|
horizontal: _ref3,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
/*
|
|
2
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -6,24 +7,42 @@
|
|
|
6
7
|
* Side Public License, v 1.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
|
-
import { Children, cloneElement, useEffect } from 'react';
|
|
10
|
+
import { Children, cloneElement, useState, useEffect, useCallback } from 'react';
|
|
11
|
+
function isMutableRef(ref) {
|
|
12
|
+
return ref != null && ref.hasOwnProperty('current');
|
|
13
|
+
}
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* The `EuiValidatableControl` component should be used in scenarios where
|
|
13
17
|
* we can render the validated `<input>` as its direct child.
|
|
14
|
-
*
|
|
15
|
-
* It flags the underlying control as invalid via `aria-invalid`, which EUI form
|
|
16
|
-
* controls use to render their invalid styling. Note that it intentionally does
|
|
17
|
-
* *not* hook into the native constraint validation API (`setCustomValidity`) -
|
|
18
|
-
* `isInvalid` is a presentational prop, and tying it to native validity would
|
|
19
|
-
* block native form submission and surface a non-localized native error tooltip.
|
|
20
18
|
*/
|
|
21
19
|
|
|
22
20
|
export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
23
21
|
var isInvalid = _ref.isInvalid,
|
|
24
22
|
children = _ref.children;
|
|
23
|
+
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
24
|
+
var _useState = useState(null),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
control = _useState2[0],
|
|
27
|
+
setControl = _useState2[1];
|
|
25
28
|
var child = Children.only(children);
|
|
29
|
+
var childRef = child.ref;
|
|
30
|
+
var replacedRef = useCallback(function (element) {
|
|
31
|
+
setControl(element);
|
|
32
|
+
|
|
33
|
+
// Call the original ref, if any
|
|
34
|
+
if (typeof childRef === 'function') {
|
|
35
|
+
childRef(element);
|
|
36
|
+
} else if (isMutableRef(childRef)) {
|
|
37
|
+
childRef.current = element;
|
|
38
|
+
}
|
|
39
|
+
}, [childRef]);
|
|
40
|
+
useSetControlValidity({
|
|
41
|
+
controlEl: control,
|
|
42
|
+
isInvalid: isInvalid
|
|
43
|
+
});
|
|
26
44
|
return /*#__PURE__*/cloneElement(child, {
|
|
45
|
+
ref: replacedRef,
|
|
27
46
|
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
28
47
|
});
|
|
29
48
|
};
|
|
@@ -37,6 +56,10 @@ export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
|
37
56
|
export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
38
57
|
var isInvalid = _ref2.isInvalid,
|
|
39
58
|
controlEl = _ref2.controlEl;
|
|
59
|
+
useSetControlValidity({
|
|
60
|
+
controlEl: controlEl,
|
|
61
|
+
isInvalid: isInvalid
|
|
62
|
+
});
|
|
40
63
|
useEffect(function () {
|
|
41
64
|
if (!controlEl) return;
|
|
42
65
|
if (typeof isInvalid === 'boolean') {
|
|
@@ -45,4 +68,22 @@ export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
|
45
68
|
controlEl.removeAttribute('aria-invalid');
|
|
46
69
|
}
|
|
47
70
|
}, [isInvalid, controlEl]);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Internal `setCustomValidity` helper
|
|
75
|
+
*/
|
|
76
|
+
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
77
|
+
var controlEl = _ref3.controlEl,
|
|
78
|
+
isInvalid = _ref3.isInvalid;
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (isInvalid) {
|
|
84
|
+
controlEl.setCustomValidity('Invalid');
|
|
85
|
+
} else {
|
|
86
|
+
controlEl.setCustomValidity('');
|
|
87
|
+
}
|
|
88
|
+
}, [isInvalid, controlEl]);
|
|
48
89
|
};
|
|
@@ -133,7 +133,7 @@ var EuiDatePicker = exports.EuiDatePicker = function EuiDatePicker(_ref) {
|
|
|
133
133
|
fullDateFormat = "".concat(dateFormat, " ").concat(timeFormat);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
// Set an internal ref on ReactDatePicker's `input` so we can set its
|
|
136
|
+
// Set an internal ref on ReactDatePicker's `input` so we can set its :invalid state via useEuiValidatableControl
|
|
137
137
|
var _useState = (0, _react.useState)(null),
|
|
138
138
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
139
139
|
inputValidityRef = _useState2[0],
|
|
@@ -24,7 +24,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
24
24
|
var euiFieldPasswordStyles = exports.euiFieldPasswordStyles = function euiFieldPasswordStyles(euiThemeContext) {
|
|
25
25
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
26
26
|
return {
|
|
27
|
-
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:
|
|
27
|
+
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
|
|
28
28
|
// Only remove Edge's internal reveal button if we're providing a custom one
|
|
29
29
|
// This pseudo-element is still supported in Chromium-based Edge.
|
|
30
30
|
withToggle: _ref,
|
|
@@ -17,7 +17,7 @@ var _form = require("../form.styles");
|
|
|
17
17
|
var euiFieldSearchStyles = exports.euiFieldSearchStyles = function euiFieldSearchStyles(euiThemeContext) {
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
return {
|
|
20
|
-
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:
|
|
20
|
+
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
|
|
21
21
|
// Skip the css() on the default height to avoid generating a className
|
|
22
22
|
uncompressed: formStyles.uncompressed,
|
|
23
23
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -209,7 +209,7 @@ var euiFormControlAutoFillStyles = exports.euiFormControlAutoFillStyles = functi
|
|
|
209
209
|
var borderShadow = "inset 0 0 0 var(--euiFormControlStateAutofillWidth) var(--euiFormControlStateAutofillColor), ".concat(backgroundShadow);
|
|
210
210
|
|
|
211
211
|
// These styles only apply/override Chrome/webkit browsers - Firefox does not set autofill styles
|
|
212
|
-
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:
|
|
212
|
+
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:invalid {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
|
|
213
213
|
};
|
|
214
214
|
var euiFormControlAutofillUnsetStyles = exports.euiFormControlAutofillUnsetStyles = "\n\n";
|
|
215
215
|
var euiFormControlShowBackgroundLine = exports.euiFormControlShowBackgroundLine = function euiFormControlShowBackgroundLine(euiThemeContext, color) {
|
|
@@ -18,7 +18,7 @@ var euiSelectStyles = exports.euiSelectStyles = function euiSelectStyles(euiThem
|
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
var formVariables = (0, _form.euiFormVariables)(euiThemeContext);
|
|
20
20
|
return {
|
|
21
|
-
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:
|
|
21
|
+
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
22
22
|
// Skip the css() on the default height to avoid generating a className
|
|
23
23
|
uncompressed: formStyles.uncompressed,
|
|
24
24
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -51,7 +51,7 @@ var euiTextAreaStyles = exports.euiTextAreaStyles = function euiTextAreaStyles(e
|
|
|
51
51
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
52
52
|
var formVars = (0, _form.euiFormVariables)(euiThemeContext);
|
|
53
53
|
return {
|
|
54
|
-
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:
|
|
54
|
+
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
55
55
|
resize: {
|
|
56
56
|
vertical: _ref4,
|
|
57
57
|
horizontal: _ref3,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
/*
|
|
9
11
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -13,22 +15,41 @@ var _react = require("react");
|
|
|
13
15
|
* Side Public License, v 1.
|
|
14
16
|
*/
|
|
15
17
|
|
|
18
|
+
function isMutableRef(ref) {
|
|
19
|
+
return ref != null && ref.hasOwnProperty('current');
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* The `EuiValidatableControl` component should be used in scenarios where
|
|
18
24
|
* we can render the validated `<input>` as its direct child.
|
|
19
|
-
*
|
|
20
|
-
* It flags the underlying control as invalid via `aria-invalid`, which EUI form
|
|
21
|
-
* controls use to render their invalid styling. Note that it intentionally does
|
|
22
|
-
* *not* hook into the native constraint validation API (`setCustomValidity`) -
|
|
23
|
-
* `isInvalid` is a presentational prop, and tying it to native validity would
|
|
24
|
-
* block native form submission and surface a non-localized native error tooltip.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
var EuiValidatableControl = exports.EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
28
28
|
var isInvalid = _ref.isInvalid,
|
|
29
29
|
children = _ref.children;
|
|
30
|
+
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
31
|
+
var _useState = (0, _react.useState)(null),
|
|
32
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
+
control = _useState2[0],
|
|
34
|
+
setControl = _useState2[1];
|
|
30
35
|
var child = _react.Children.only(children);
|
|
36
|
+
var childRef = child.ref;
|
|
37
|
+
var replacedRef = (0, _react.useCallback)(function (element) {
|
|
38
|
+
setControl(element);
|
|
39
|
+
|
|
40
|
+
// Call the original ref, if any
|
|
41
|
+
if (typeof childRef === 'function') {
|
|
42
|
+
childRef(element);
|
|
43
|
+
} else if (isMutableRef(childRef)) {
|
|
44
|
+
childRef.current = element;
|
|
45
|
+
}
|
|
46
|
+
}, [childRef]);
|
|
47
|
+
useSetControlValidity({
|
|
48
|
+
controlEl: control,
|
|
49
|
+
isInvalid: isInvalid
|
|
50
|
+
});
|
|
31
51
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
52
|
+
ref: replacedRef,
|
|
32
53
|
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
33
54
|
});
|
|
34
55
|
};
|
|
@@ -42,6 +63,10 @@ var EuiValidatableControl = exports.EuiValidatableControl = function EuiValidata
|
|
|
42
63
|
var useEuiValidatableControl = exports.useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
43
64
|
var isInvalid = _ref2.isInvalid,
|
|
44
65
|
controlEl = _ref2.controlEl;
|
|
66
|
+
useSetControlValidity({
|
|
67
|
+
controlEl: controlEl,
|
|
68
|
+
isInvalid: isInvalid
|
|
69
|
+
});
|
|
45
70
|
(0, _react.useEffect)(function () {
|
|
46
71
|
if (!controlEl) return;
|
|
47
72
|
if (typeof isInvalid === 'boolean') {
|
|
@@ -50,4 +75,22 @@ var useEuiValidatableControl = exports.useEuiValidatableControl = function useEu
|
|
|
50
75
|
controlEl.removeAttribute('aria-invalid');
|
|
51
76
|
}
|
|
52
77
|
}, [isInvalid, controlEl]);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Internal `setCustomValidity` helper
|
|
82
|
+
*/
|
|
83
|
+
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
84
|
+
var controlEl = _ref3.controlEl,
|
|
85
|
+
isInvalid = _ref3.isInvalid;
|
|
86
|
+
(0, _react.useEffect)(function () {
|
|
87
|
+
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (isInvalid) {
|
|
91
|
+
controlEl.setCustomValidity('Invalid');
|
|
92
|
+
} else {
|
|
93
|
+
controlEl.setCustomValidity('');
|
|
94
|
+
}
|
|
95
|
+
}, [isInvalid, controlEl]);
|
|
53
96
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "116.
|
|
4
|
+
"version": "116.4.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
@@ -274,6 +274,5 @@
|
|
|
274
274
|
],
|
|
275
275
|
"installConfig": {
|
|
276
276
|
"hoistingLimits": "workspaces"
|
|
277
|
-
}
|
|
278
|
-
"stableVersion": "116.3.1"
|
|
277
|
+
}
|
|
279
278
|
}
|
|
@@ -134,7 +134,7 @@ var EuiDatePicker = exports.EuiDatePicker = function EuiDatePicker(_ref) {
|
|
|
134
134
|
fullDateFormat = "".concat(dateFormat, " ").concat(timeFormat);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Set an internal ref on ReactDatePicker's `input` so we can set its
|
|
137
|
+
// Set an internal ref on ReactDatePicker's `input` so we can set its :invalid state via useEuiValidatableControl
|
|
138
138
|
var _useState = (0, _react.useState)(null),
|
|
139
139
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
140
140
|
inputValidityRef = _useState2[0],
|
|
@@ -24,7 +24,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
24
24
|
var euiFieldPasswordStyles = exports.euiFieldPasswordStyles = function euiFieldPasswordStyles(euiThemeContext) {
|
|
25
25
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
26
26
|
return {
|
|
27
|
-
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:
|
|
27
|
+
euiFieldPassword: /*#__PURE__*/(0, _react.css)(formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
|
|
28
28
|
// Only remove Edge's internal reveal button if we're providing a custom one
|
|
29
29
|
// This pseudo-element is still supported in Chromium-based Edge.
|
|
30
30
|
withToggle: _ref,
|
|
@@ -17,7 +17,7 @@ var _form = require("../form.styles");
|
|
|
17
17
|
var euiFieldSearchStyles = exports.euiFieldSearchStyles = function euiFieldSearchStyles(euiThemeContext) {
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
return {
|
|
20
|
-
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:
|
|
20
|
+
euiFieldSearch: /*#__PURE__*/(0, _react.css)("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
|
|
21
21
|
// Skip the css() on the default height to avoid generating a className
|
|
22
22
|
uncompressed: formStyles.uncompressed,
|
|
23
23
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -209,7 +209,7 @@ var euiFormControlAutoFillStyles = exports.euiFormControlAutoFillStyles = functi
|
|
|
209
209
|
var borderShadow = "inset 0 0 0 var(--euiFormControlStateAutofillWidth) var(--euiFormControlStateAutofillColor), ".concat(backgroundShadow);
|
|
210
210
|
|
|
211
211
|
// These styles only apply/override Chrome/webkit browsers - Firefox does not set autofill styles
|
|
212
|
-
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:
|
|
212
|
+
return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:invalid {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
|
|
213
213
|
};
|
|
214
214
|
var euiFormControlAutofillUnsetStyles = exports.euiFormControlAutofillUnsetStyles = "\n\n";
|
|
215
215
|
var euiFormControlShowBackgroundLine = exports.euiFormControlShowBackgroundLine = function euiFormControlShowBackgroundLine(euiThemeContext, color) {
|
|
@@ -18,7 +18,7 @@ var euiSelectStyles = exports.euiSelectStyles = function euiSelectStyles(euiThem
|
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
var formVariables = (0, _form.euiFormVariables)(euiThemeContext);
|
|
20
20
|
return {
|
|
21
|
-
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:
|
|
21
|
+
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
22
22
|
// Skip the css() on the default height to avoid generating a className
|
|
23
23
|
uncompressed: formStyles.uncompressed,
|
|
24
24
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -51,7 +51,7 @@ var euiTextAreaStyles = exports.euiTextAreaStyles = function euiTextAreaStyles(e
|
|
|
51
51
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
52
52
|
var formVars = (0, _form.euiFormVariables)(euiThemeContext);
|
|
53
53
|
return {
|
|
54
|
-
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:
|
|
54
|
+
euiTextArea: /*#__PURE__*/(0, _react.css)(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
55
55
|
resize: {
|
|
56
56
|
vertical: _ref4,
|
|
57
57
|
horizontal: _ref3,
|