@elastic/eui 77.2.2 → 78.0.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/README.md +7 -21
- package/dist/eui_theme_dark.css +28 -29
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +28 -29
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/avatar/avatar.js +15 -3
- package/es/components/avatar/avatar.styles.js +46 -9
- package/es/components/form/form.styles.js +2 -2
- package/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/es/test/rtl/custom_render.js +11 -1
- package/es/test/rtl/index.d.ts +1 -1
- package/es/test/rtl/index.js +1 -1
- package/eui.d.ts +14 -1
- package/lib/components/avatar/avatar.js +17 -4
- package/lib/components/avatar/avatar.styles.js +46 -9
- package/lib/components/form/form.styles.js +2 -2
- package/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/lib/test/rtl/custom_render.js +11 -2
- package/lib/test/rtl/index.d.ts +1 -1
- package/lib/test/rtl/index.js +8 -1
- package/optimize/es/components/avatar/avatar.js +8 -3
- package/optimize/es/components/avatar/avatar.styles.js +46 -9
- package/optimize/es/components/form/form.styles.js +2 -2
- package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/optimize/es/test/rtl/custom_render.js +11 -1
- package/optimize/es/test/rtl/index.d.ts +1 -1
- package/optimize/es/test/rtl/index.js +1 -1
- package/optimize/lib/components/avatar/avatar.js +10 -4
- package/optimize/lib/components/avatar/avatar.styles.js +46 -9
- package/optimize/lib/components/form/form.styles.js +2 -2
- package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/optimize/lib/test/rtl/custom_render.js +11 -2
- package/optimize/lib/test/rtl/index.d.ts +1 -1
- package/optimize/lib/test/rtl/index.js +8 -1
- package/package.json +2 -2
- package/src/components/form/switch/_switch.scss +30 -26
- package/src/global_styling/variables/_form.scss +2 -2
- package/test-env/components/avatar/avatar.js +17 -4
- package/test-env/components/avatar/avatar.styles.js +46 -9
- package/test-env/components/form/form.styles.js +2 -2
- package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/test-env/test/rtl/custom_render.js +11 -2
- package/test-env/test/rtl/index.js +8 -1
|
@@ -42,10 +42,10 @@ export var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
42
42
|
inputGroupBorder: 'none'
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
// Colors - specific
|
|
45
|
+
// Colors - specific to checkboxes, radios, switches, and range thumbs
|
|
46
46
|
var customControlColors = {
|
|
47
47
|
customControlDisabledIconColor: isColorDark ? shade(euiTheme.colors.mediumShade, 0.38) : tint(euiTheme.colors.mediumShade, 0.485),
|
|
48
|
-
customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.
|
|
48
|
+
customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.4) : tint(euiTheme.colors.lightestShade, 0.31)
|
|
49
49
|
};
|
|
50
50
|
var controlLayout = {
|
|
51
51
|
controlLayoutGroupInputHeight: mathWithUnits(controlHeight, function (x) {
|
|
@@ -62,9 +62,9 @@ export var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
|
62
62
|
var body = {
|
|
63
63
|
query: values.map(function (value) {
|
|
64
64
|
if (isString(value) && value.match(/\s/)) {
|
|
65
|
-
return "
|
|
65
|
+
return "+\"".concat(value, "\"");
|
|
66
66
|
}
|
|
67
|
-
return value;
|
|
67
|
+
return "+".concat(value);
|
|
68
68
|
}).join(' ')
|
|
69
69
|
};
|
|
70
70
|
if (body.query === '') {
|
|
@@ -40,4 +40,14 @@ export { customRender as render };
|
|
|
40
40
|
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
41
41
|
*/
|
|
42
42
|
var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
|
|
43
|
-
export { customScreen as screen };
|
|
43
|
+
export { customScreen as screen };
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Custom within util with EUI query helpers
|
|
47
|
+
*
|
|
48
|
+
* @see https://testing-library.com/docs/dom-testing-library/api-within/
|
|
49
|
+
*/
|
|
50
|
+
var customWithin = function customWithin(element) {
|
|
51
|
+
return within(element, _objectSpread(_objectSpread({}, queries), dataTestSubjQueries));
|
|
52
|
+
};
|
|
53
|
+
export { customWithin as within };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './component_helpers';
|
|
2
2
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
|
|
3
|
-
export { render, screen } from './custom_render';
|
|
3
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
export * from './component_helpers';
|
|
10
10
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject } from './data_test_subj_queries';
|
|
11
|
-
export { render, screen } from './custom_render';
|
|
11
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = void 0;
|
|
7
|
+
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = exports.CASING = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -16,13 +16,16 @@ var _services = require("../../services");
|
|
|
16
16
|
var _icon = require("../icon");
|
|
17
17
|
var _avatar = require("./avatar.styles");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"]
|
|
19
|
+
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
|
|
20
|
+
_excluded2 = ["casing"];
|
|
20
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
23
|
var SIZES = ['s', 'm', 'l', 'xl'];
|
|
23
24
|
exports.SIZES = SIZES;
|
|
24
25
|
var TYPES = ['space', 'user'];
|
|
25
26
|
exports.TYPES = TYPES;
|
|
27
|
+
var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
|
|
28
|
+
exports.CASING = CASING;
|
|
26
29
|
var EuiAvatar = function EuiAvatar(_ref) {
|
|
27
30
|
var _classNames;
|
|
28
31
|
var className = _ref.className,
|
|
@@ -41,14 +44,17 @@ var EuiAvatar = function EuiAvatar(_ref) {
|
|
|
41
44
|
_ref$isDisabled = _ref.isDisabled,
|
|
42
45
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
43
46
|
style = _ref.style,
|
|
44
|
-
|
|
47
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
|
+
var _props$casing = props.casing,
|
|
49
|
+
casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
|
|
50
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded2);
|
|
45
51
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
46
52
|
var styles = (0, _avatar.euiAvatarStyles)(euiTheme);
|
|
47
53
|
var visColors = (0, _services.euiPaletteColorBlindBehindText)();
|
|
48
54
|
var isPlain = color === 'plain';
|
|
49
55
|
var isSubdued = color === 'subdued';
|
|
50
56
|
var classes = (0, _classnames.default)('euiAvatar', (_classNames = {}, (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(size), size), (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(type), type), (0, _defineProperty2.default)(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
|
|
51
|
-
var cssStyles = [styles.euiAvatar, styles[size], styles[
|
|
57
|
+
var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
|
|
52
58
|
checkValidInitials(initials);
|
|
53
59
|
var avatarStyle = _objectSpread({}, style);
|
|
54
60
|
var iconCustomColor = iconColor;
|
|
@@ -7,12 +7,44 @@ exports.euiAvatarStyles = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _global_styling = require("../../global_styling");
|
|
9
9
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
-
var _avatarSize = function _avatarSize(
|
|
11
|
-
var size =
|
|
12
|
-
fontSize =
|
|
10
|
+
var _avatarSize = function _avatarSize(_ref7) {
|
|
11
|
+
var size = _ref7.size,
|
|
12
|
+
fontSize = _ref7.fontSize;
|
|
13
13
|
return "\n ".concat((0, _global_styling.logicalCSS)('width', size), ";\n ").concat((0, _global_styling.logicalCSS)('height', size), ";\n line-height: ").concat(size, ";\n font-size: ").concat(fontSize, ";\n ");
|
|
14
14
|
};
|
|
15
15
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "4wfy2n-none",
|
|
17
|
+
styles: "text-transform:none;label:none;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "4wfy2n-none",
|
|
20
|
+
styles: "text-transform:none;label:none;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
};
|
|
23
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
24
|
+
name: "5xhpzh-lowercase",
|
|
25
|
+
styles: "text-transform:lowercase;label:lowercase;"
|
|
26
|
+
} : {
|
|
27
|
+
name: "5xhpzh-lowercase",
|
|
28
|
+
styles: "text-transform:lowercase;label:lowercase;",
|
|
29
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
|
+
};
|
|
31
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
32
|
+
name: "1x2qsb1-uppercase",
|
|
33
|
+
styles: "text-transform:uppercase;label:uppercase;"
|
|
34
|
+
} : {
|
|
35
|
+
name: "1x2qsb1-uppercase",
|
|
36
|
+
styles: "text-transform:uppercase;label:uppercase;",
|
|
37
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
38
|
+
};
|
|
39
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
40
|
+
name: "mxeh3g-capitalize",
|
|
41
|
+
styles: "text-transform:capitalize;label:capitalize;"
|
|
42
|
+
} : {
|
|
43
|
+
name: "mxeh3g-capitalize",
|
|
44
|
+
styles: "text-transform:capitalize;label:capitalize;",
|
|
45
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
46
|
+
};
|
|
47
|
+
var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
16
48
|
name: "14sj6wh-isDisabled",
|
|
17
49
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;"
|
|
18
50
|
} : {
|
|
@@ -20,7 +52,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
52
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;",
|
|
21
53
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
54
|
};
|
|
23
|
-
var
|
|
55
|
+
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
24
56
|
name: "ont6vs-user",
|
|
25
57
|
styles: "border-radius:50%;label:user;"
|
|
26
58
|
} : {
|
|
@@ -28,18 +60,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
28
60
|
styles: "border-radius:50%;label:user;",
|
|
29
61
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
62
|
};
|
|
31
|
-
var euiAvatarStyles = function euiAvatarStyles(
|
|
32
|
-
var euiTheme =
|
|
63
|
+
var euiAvatarStyles = function euiAvatarStyles(_ref8) {
|
|
64
|
+
var euiTheme = _ref8.euiTheme;
|
|
33
65
|
return {
|
|
34
66
|
// Base
|
|
35
67
|
euiAvatar: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;background-size:cover;", (0, _global_styling.logicalTextAlignCSS)('center'), ";", (0, _global_styling.logicalCSS)('overflow-x', 'hidden'), "font-weight:", euiTheme.font.weight.medium, ";;label:euiAvatar;"),
|
|
36
68
|
// Variants
|
|
37
69
|
plain: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.emptyShade, ";;label:plain;"),
|
|
38
70
|
subdued: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.lightestShade, ";;label:subdued;"),
|
|
39
|
-
user:
|
|
71
|
+
user: _ref6,
|
|
40
72
|
space: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
|
|
41
73
|
// States
|
|
42
|
-
isDisabled:
|
|
74
|
+
isDisabled: _ref5,
|
|
43
75
|
// Sizes
|
|
44
76
|
s: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
45
77
|
size: euiTheme.size.l,
|
|
@@ -56,7 +88,12 @@ var euiAvatarStyles = function euiAvatarStyles(_ref4) {
|
|
|
56
88
|
xl: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
57
89
|
size: "calc(".concat(euiTheme.size.base, " * 4)"),
|
|
58
90
|
fontSize: "calc(".concat(euiTheme.size.xl, " * 0.8)")
|
|
59
|
-
}), ";label:xl;")
|
|
91
|
+
}), ";label:xl;"),
|
|
92
|
+
// Casing
|
|
93
|
+
capitalize: _ref4,
|
|
94
|
+
uppercase: _ref3,
|
|
95
|
+
lowercase: _ref2,
|
|
96
|
+
none: _ref
|
|
60
97
|
};
|
|
61
98
|
};
|
|
62
99
|
exports.euiAvatarStyles = euiAvatarStyles;
|
|
@@ -41,10 +41,10 @@ var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
41
41
|
inputGroupBorder: 'none'
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// Colors - specific
|
|
44
|
+
// Colors - specific to checkboxes, radios, switches, and range thumbs
|
|
45
45
|
var customControlColors = {
|
|
46
46
|
customControlDisabledIconColor: isColorDark ? (0, _services.shade)(euiTheme.colors.mediumShade, 0.38) : (0, _services.tint)(euiTheme.colors.mediumShade, 0.485),
|
|
47
|
-
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.
|
|
47
|
+
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.4) : (0, _services.tint)(euiTheme.colors.lightestShade, 0.31)
|
|
48
48
|
};
|
|
49
49
|
var controlLayout = {
|
|
50
50
|
controlLayoutGroupInputHeight: (0, _global_styling.mathWithUnits)(controlHeight, function (x) {
|
|
@@ -61,9 +61,9 @@ var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
|
61
61
|
var body = {
|
|
62
62
|
query: values.map(function (value) {
|
|
63
63
|
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
64
|
-
return "
|
|
64
|
+
return "+\"".concat(value, "\"");
|
|
65
65
|
}
|
|
66
|
-
return value;
|
|
66
|
+
return "+".concat(value);
|
|
67
67
|
}).join(' ')
|
|
68
68
|
};
|
|
69
69
|
if (body.query === '') {
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.screen = exports.render = void 0;
|
|
8
|
+
exports.within = exports.screen = exports.render = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = require("@testing-library/react");
|
|
@@ -40,4 +40,13 @@ exports.render = customRender;
|
|
|
40
40
|
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
41
41
|
*/
|
|
42
42
|
var customScreen = _objectSpread(_objectSpread({}, _react.screen), (0, _react.within)(document.body, dataTestSubjQueries));
|
|
43
|
-
exports.screen = customScreen;
|
|
43
|
+
exports.screen = customScreen;
|
|
44
|
+
/**
|
|
45
|
+
* Custom within util with EUI query helpers
|
|
46
|
+
*
|
|
47
|
+
* @see https://testing-library.com/docs/dom-testing-library/api-within/
|
|
48
|
+
*/
|
|
49
|
+
var customWithin = function customWithin(element) {
|
|
50
|
+
return (0, _react.within)(element, _objectSpread(_objectSpread({}, _react.queries), dataTestSubjQueries));
|
|
51
|
+
};
|
|
52
|
+
exports.within = customWithin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './component_helpers';
|
|
2
2
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
|
|
3
|
-
export { render, screen } from './custom_render';
|
|
3
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -11,7 +11,8 @@ var _exportNames = {
|
|
|
11
11
|
findAllByTestSubject: true,
|
|
12
12
|
findByTestSubject: true,
|
|
13
13
|
render: true,
|
|
14
|
-
screen: true
|
|
14
|
+
screen: true,
|
|
15
|
+
within: true
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "findAllByTestSubject", {
|
|
17
18
|
enumerable: true,
|
|
@@ -61,6 +62,12 @@ Object.defineProperty(exports, "screen", {
|
|
|
61
62
|
return _custom_render.screen;
|
|
62
63
|
}
|
|
63
64
|
});
|
|
65
|
+
Object.defineProperty(exports, "within", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _custom_render.within;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
64
71
|
var _component_helpers = require("./component_helpers");
|
|
65
72
|
Object.keys(_component_helpers).forEach(function (key) {
|
|
66
73
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "78.0.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
8
8
|
"types": "eui.d.ts",
|
|
9
|
-
"docker_image": "node:16.
|
|
9
|
+
"docker_image": "node:16.19.1",
|
|
10
10
|
"sideEffects": [
|
|
11
11
|
"*.css",
|
|
12
12
|
"*.scss"
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// stylelint-disable max-nesting-depth
|
|
3
3
|
|
|
4
4
|
.euiSwitch {
|
|
5
|
+
$euiSwitchOffDisabledColor: lightOrDarkTheme(transparentize($euiColorLightShade, .5), transparentize($euiColorDarkShade, .4));
|
|
6
|
+
$euiSwitchDisabledThumbColor: lightOrDarkTheme(transparentize($euiColorDarkShade, .5), $euiColorDarkShade);
|
|
7
|
+
|
|
5
8
|
position: relative;
|
|
6
9
|
display: inline-flex;
|
|
7
10
|
align-items: flex-start;
|
|
@@ -24,30 +27,6 @@
|
|
|
24
27
|
@include euiCustomControlFocused;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
&:disabled {
|
|
28
|
-
&:hover,
|
|
29
|
-
~ .euiSwitch__label:hover {
|
|
30
|
-
cursor: not-allowed;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.euiSwitch__body {
|
|
34
|
-
background-color: $euiSwitchOffColor;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.euiSwitch__thumb {
|
|
38
|
-
@include euiCustomControlDisabled;
|
|
39
|
-
background-color: $euiSwitchOffColor;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.euiSwitch__icon {
|
|
43
|
-
fill: $euiFormCustomControlDisabledIconColor;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
+ .euiSwitch__label {
|
|
47
|
-
color: $euiFormControlDisabledColor;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
30
|
&[aria-checked='false'] {
|
|
52
31
|
.euiSwitch__body {
|
|
53
32
|
background-color: $euiSwitchOffColor;
|
|
@@ -67,6 +46,31 @@
|
|
|
67
46
|
}
|
|
68
47
|
}
|
|
69
48
|
}
|
|
49
|
+
|
|
50
|
+
&:disabled {
|
|
51
|
+
&:hover,
|
|
52
|
+
~ .euiSwitch__label:hover {
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.euiSwitch__body {
|
|
57
|
+
background-color: $euiSwitchOffDisabledColor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.euiSwitch__thumb {
|
|
61
|
+
background-color: rgba(0,0,0,0);
|
|
62
|
+
border-color: $euiSwitchDisabledThumbColor;
|
|
63
|
+
box-shadow: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.euiSwitch__icon {
|
|
67
|
+
fill: $euiColorDarkShade;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
+ .euiSwitch__label {
|
|
71
|
+
color: $euiFormControlDisabledColor;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
.euiSwitch__body {
|
|
@@ -107,7 +111,7 @@
|
|
|
107
111
|
width: $euiSwitchWidth - ($euiSwitchThumbSize / 2) + $euiSizeS;
|
|
108
112
|
height: $euiSwitchIconHeight;
|
|
109
113
|
transition: left $euiAnimSpeedNormal $euiAnimSlightBounce, right $euiAnimSpeedNormal $euiAnimSlightBounce;
|
|
110
|
-
fill: $
|
|
114
|
+
fill: $euiColorEmptyShade;
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
.euiSwitch__icon--checked {
|
|
@@ -194,7 +198,7 @@
|
|
|
194
198
|
.euiSwitch__button[aria-checked='false'],
|
|
195
199
|
.euiSwitch__button[aria-checked='true']:disabled {
|
|
196
200
|
.euiSwitch__thumb {
|
|
197
|
-
border-color: $
|
|
201
|
+
border-color: $euiSwitchDisabledThumbColor;
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
204
|
|
|
@@ -33,13 +33,13 @@ $euiFormBorderOpaqueColor: shadeOrTint(desaturate(adjust-hue($euiColorPrimary, 2
|
|
|
33
33
|
$euiFormBorderColor: transparentize($euiFormBorderOpaqueColor, .9) !default;
|
|
34
34
|
$euiFormBorderDisabledColor: transparentize($euiFormBorderOpaqueColor, .9) !default;
|
|
35
35
|
$euiFormCustomControlDisabledIconColor: shadeOrTint($euiColorMediumShade, 38%, 48.5%) !default; // exact 508c foreground for $euiColorLightShade
|
|
36
|
-
$euiFormCustomControlBorderColor: shadeOrTint($euiColorLightestShade,
|
|
36
|
+
$euiFormCustomControlBorderColor: shadeOrTint($euiColorLightestShade, 40%, 31%) !default;
|
|
37
37
|
$euiFormControlDisabledColor: $euiColorMediumShade !default;
|
|
38
38
|
$euiFormControlBoxShadow: 0 0 transparent !default;
|
|
39
39
|
$euiFormControlPlaceholderText: makeHighContrastColor($euiTextSubduedColor, $euiFormBackgroundColor) !default;
|
|
40
40
|
$euiFormInputGroupLabelBackground: tintOrShade($euiColorLightShade, 50%, 15%) !default;
|
|
41
41
|
$euiFormInputGroupBorder: none !default;
|
|
42
|
-
$euiSwitchOffColor: lightOrDarkTheme(transparentize($
|
|
42
|
+
$euiSwitchOffColor: lightOrDarkTheme(transparentize($euiColorDarkShade, .25), transparentize($euiColorDarkShade, .4)) !default;
|
|
43
43
|
|
|
44
44
|
// Icons sizes
|
|
45
45
|
$euiFormControlIconSizes: (
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = void 0;
|
|
7
|
+
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = exports.CASING = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -17,13 +17,16 @@ var _services = require("../../services");
|
|
|
17
17
|
var _icon = require("../icon");
|
|
18
18
|
var _avatar = require("./avatar.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"]
|
|
20
|
+
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
|
|
21
|
+
_excluded2 = ["casing"];
|
|
21
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
24
|
var SIZES = ['s', 'm', 'l', 'xl'];
|
|
24
25
|
exports.SIZES = SIZES;
|
|
25
26
|
var TYPES = ['space', 'user'];
|
|
26
27
|
exports.TYPES = TYPES;
|
|
28
|
+
var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
|
|
29
|
+
exports.CASING = CASING;
|
|
27
30
|
var EuiAvatar = function EuiAvatar(_ref) {
|
|
28
31
|
var _classNames;
|
|
29
32
|
var className = _ref.className,
|
|
@@ -42,14 +45,17 @@ var EuiAvatar = function EuiAvatar(_ref) {
|
|
|
42
45
|
_ref$isDisabled = _ref.isDisabled,
|
|
43
46
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
44
47
|
style = _ref.style,
|
|
45
|
-
|
|
48
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
49
|
+
var _props$casing = props.casing,
|
|
50
|
+
casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
|
|
51
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded2);
|
|
46
52
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
47
53
|
var styles = (0, _avatar.euiAvatarStyles)(euiTheme);
|
|
48
54
|
var visColors = (0, _services.euiPaletteColorBlindBehindText)();
|
|
49
55
|
var isPlain = color === 'plain';
|
|
50
56
|
var isSubdued = color === 'subdued';
|
|
51
57
|
var classes = (0, _classnames.default)('euiAvatar', (_classNames = {}, (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(size), size), (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(type), type), (0, _defineProperty2.default)(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
|
|
52
|
-
var cssStyles = [styles.euiAvatar, styles[size], styles[
|
|
58
|
+
var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
|
|
53
59
|
checkValidInitials(initials);
|
|
54
60
|
var avatarStyle = _objectSpread({}, style);
|
|
55
61
|
var iconCustomColor = iconColor;
|
|
@@ -142,6 +148,13 @@ EuiAvatar.propTypes = {
|
|
|
142
148
|
*/
|
|
143
149
|
type: _propTypes.default.any,
|
|
144
150
|
size: _propTypes.default.any,
|
|
151
|
+
/**
|
|
152
|
+
* Sets the letter casing of the displayed initials.
|
|
153
|
+
* Defaults to `uppercase` for `type="user"` avatars.
|
|
154
|
+
* Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
|
|
155
|
+
* @default uppercase
|
|
156
|
+
*/
|
|
157
|
+
casing: _propTypes.default.any,
|
|
145
158
|
/**
|
|
146
159
|
* Grays out the avatar to simulate being disabled
|
|
147
160
|
*/
|
|
@@ -7,12 +7,44 @@ exports.euiAvatarStyles = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _global_styling = require("../../global_styling");
|
|
9
9
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
-
var _avatarSize = function _avatarSize(
|
|
11
|
-
var size =
|
|
12
|
-
fontSize =
|
|
10
|
+
var _avatarSize = function _avatarSize(_ref7) {
|
|
11
|
+
var size = _ref7.size,
|
|
12
|
+
fontSize = _ref7.fontSize;
|
|
13
13
|
return "\n ".concat((0, _global_styling.logicalCSS)('width', size), ";\n ").concat((0, _global_styling.logicalCSS)('height', size), ";\n line-height: ").concat(size, ";\n font-size: ").concat(fontSize, ";\n ");
|
|
14
14
|
};
|
|
15
15
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "4wfy2n-none",
|
|
17
|
+
styles: "text-transform:none;label:none;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "4wfy2n-none",
|
|
20
|
+
styles: "text-transform:none;label:none;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
};
|
|
23
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
24
|
+
name: "5xhpzh-lowercase",
|
|
25
|
+
styles: "text-transform:lowercase;label:lowercase;"
|
|
26
|
+
} : {
|
|
27
|
+
name: "5xhpzh-lowercase",
|
|
28
|
+
styles: "text-transform:lowercase;label:lowercase;",
|
|
29
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
|
+
};
|
|
31
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
32
|
+
name: "1x2qsb1-uppercase",
|
|
33
|
+
styles: "text-transform:uppercase;label:uppercase;"
|
|
34
|
+
} : {
|
|
35
|
+
name: "1x2qsb1-uppercase",
|
|
36
|
+
styles: "text-transform:uppercase;label:uppercase;",
|
|
37
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
38
|
+
};
|
|
39
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
40
|
+
name: "mxeh3g-capitalize",
|
|
41
|
+
styles: "text-transform:capitalize;label:capitalize;"
|
|
42
|
+
} : {
|
|
43
|
+
name: "mxeh3g-capitalize",
|
|
44
|
+
styles: "text-transform:capitalize;label:capitalize;",
|
|
45
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
46
|
+
};
|
|
47
|
+
var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
16
48
|
name: "14sj6wh-isDisabled",
|
|
17
49
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;"
|
|
18
50
|
} : {
|
|
@@ -20,7 +52,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
52
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;",
|
|
21
53
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
54
|
};
|
|
23
|
-
var
|
|
55
|
+
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
24
56
|
name: "ont6vs-user",
|
|
25
57
|
styles: "border-radius:50%;label:user;"
|
|
26
58
|
} : {
|
|
@@ -28,18 +60,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
28
60
|
styles: "border-radius:50%;label:user;",
|
|
29
61
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
62
|
};
|
|
31
|
-
var euiAvatarStyles = function euiAvatarStyles(
|
|
32
|
-
var euiTheme =
|
|
63
|
+
var euiAvatarStyles = function euiAvatarStyles(_ref8) {
|
|
64
|
+
var euiTheme = _ref8.euiTheme;
|
|
33
65
|
return {
|
|
34
66
|
// Base
|
|
35
67
|
euiAvatar: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;background-size:cover;", (0, _global_styling.logicalTextAlignCSS)('center'), ";", (0, _global_styling.logicalCSS)('overflow-x', 'hidden'), "font-weight:", euiTheme.font.weight.medium, ";;label:euiAvatar;"),
|
|
36
68
|
// Variants
|
|
37
69
|
plain: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.emptyShade, ";;label:plain;"),
|
|
38
70
|
subdued: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.lightestShade, ";;label:subdued;"),
|
|
39
|
-
user:
|
|
71
|
+
user: _ref6,
|
|
40
72
|
space: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
|
|
41
73
|
// States
|
|
42
|
-
isDisabled:
|
|
74
|
+
isDisabled: _ref5,
|
|
43
75
|
// Sizes
|
|
44
76
|
s: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
45
77
|
size: euiTheme.size.l,
|
|
@@ -56,7 +88,12 @@ var euiAvatarStyles = function euiAvatarStyles(_ref4) {
|
|
|
56
88
|
xl: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
57
89
|
size: "calc(".concat(euiTheme.size.base, " * 4)"),
|
|
58
90
|
fontSize: "calc(".concat(euiTheme.size.xl, " * 0.8)")
|
|
59
|
-
}), ";label:xl;")
|
|
91
|
+
}), ";label:xl;"),
|
|
92
|
+
// Casing
|
|
93
|
+
capitalize: _ref4,
|
|
94
|
+
uppercase: _ref3,
|
|
95
|
+
lowercase: _ref2,
|
|
96
|
+
none: _ref
|
|
60
97
|
};
|
|
61
98
|
};
|
|
62
99
|
exports.euiAvatarStyles = euiAvatarStyles;
|
|
@@ -41,10 +41,10 @@ var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
41
41
|
inputGroupBorder: 'none'
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// Colors - specific
|
|
44
|
+
// Colors - specific to checkboxes, radios, switches, and range thumbs
|
|
45
45
|
var customControlColors = {
|
|
46
46
|
customControlDisabledIconColor: isColorDark ? (0, _services.shade)(euiTheme.colors.mediumShade, 0.38) : (0, _services.tint)(euiTheme.colors.mediumShade, 0.485),
|
|
47
|
-
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.
|
|
47
|
+
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.4) : (0, _services.tint)(euiTheme.colors.lightestShade, 0.31)
|
|
48
48
|
};
|
|
49
49
|
var controlLayout = {
|
|
50
50
|
controlLayoutGroupInputHeight: (0, _global_styling.mathWithUnits)(controlHeight, function (x) {
|
|
@@ -61,9 +61,9 @@ var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
|
61
61
|
var body = {
|
|
62
62
|
query: values.map(function (value) {
|
|
63
63
|
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
64
|
-
return "
|
|
64
|
+
return "+\"".concat(value, "\"");
|
|
65
65
|
}
|
|
66
|
-
return value;
|
|
66
|
+
return "+".concat(value);
|
|
67
67
|
}).join(' ')
|
|
68
68
|
};
|
|
69
69
|
if (body.query === '') {
|
|
@@ -302,6 +302,13 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
302
302
|
*/
|
|
303
303
|
type: _propTypes.default.any,
|
|
304
304
|
size: _propTypes.default.any,
|
|
305
|
+
/**
|
|
306
|
+
* Sets the letter casing of the displayed initials.
|
|
307
|
+
* Defaults to `uppercase` for `type="user"` avatars.
|
|
308
|
+
* Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
|
|
309
|
+
* @default uppercase
|
|
310
|
+
*/
|
|
311
|
+
casing: _propTypes.default.any,
|
|
305
312
|
/**
|
|
306
313
|
* Grays out the avatar to simulate being disabled
|
|
307
314
|
*/
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.screen = exports.render = void 0;
|
|
8
|
+
exports.within = exports.screen = exports.render = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = require("@testing-library/react");
|
|
@@ -40,4 +40,13 @@ exports.render = customRender;
|
|
|
40
40
|
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
41
41
|
*/
|
|
42
42
|
var customScreen = _objectSpread(_objectSpread({}, _react.screen), (0, _react.within)(document.body, dataTestSubjQueries));
|
|
43
|
-
exports.screen = customScreen;
|
|
43
|
+
exports.screen = customScreen;
|
|
44
|
+
/**
|
|
45
|
+
* Custom within util with EUI query helpers
|
|
46
|
+
*
|
|
47
|
+
* @see https://testing-library.com/docs/dom-testing-library/api-within/
|
|
48
|
+
*/
|
|
49
|
+
var customWithin = function customWithin(element) {
|
|
50
|
+
return (0, _react.within)(element, _objectSpread(_objectSpread({}, _react.queries), dataTestSubjQueries));
|
|
51
|
+
};
|
|
52
|
+
exports.within = customWithin;
|
|
@@ -11,7 +11,8 @@ var _exportNames = {
|
|
|
11
11
|
findAllByTestSubject: true,
|
|
12
12
|
findByTestSubject: true,
|
|
13
13
|
render: true,
|
|
14
|
-
screen: true
|
|
14
|
+
screen: true,
|
|
15
|
+
within: true
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "findAllByTestSubject", {
|
|
17
18
|
enumerable: true,
|
|
@@ -61,6 +62,12 @@ Object.defineProperty(exports, "screen", {
|
|
|
61
62
|
return _custom_render.screen;
|
|
62
63
|
}
|
|
63
64
|
});
|
|
65
|
+
Object.defineProperty(exports, "within", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _custom_render.within;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
64
71
|
var _component_helpers = require("./component_helpers");
|
|
65
72
|
Object.keys(_component_helpers).forEach(function (key) {
|
|
66
73
|
if (key === "default" || key === "__esModule") return;
|