@elastic/eui 87.0.0 → 87.2.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.
Files changed (174) hide show
  1. package/dist/eui_theme_dark.css +0 -234
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -234
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accordion/accordion.js +82 -35
  6. package/es/components/auto_sizer/index.js +1 -1
  7. package/es/components/breadcrumbs/breadcrumb.js +2 -3
  8. package/es/components/breadcrumbs/breadcrumbs.js +2 -3
  9. package/es/components/code/code_block_virtualized.js +25 -17
  10. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
  11. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
  12. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
  13. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
  14. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
  15. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
  16. package/es/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
  17. package/es/components/control_bar/control_bar.js +2 -3
  18. package/es/components/date_picker/date_picker_range.js +5 -2
  19. package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  20. package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
  21. package/es/components/empty_prompt/empty_prompt.js +0 -1
  22. package/es/components/flyout/flyout.js +9 -7
  23. package/es/components/flyout/flyout_body.js +15 -3
  24. package/es/components/form/range/dual_range.js +33 -6
  25. package/es/components/form/range/range.js +31 -6
  26. package/es/components/form/super_select/super_select.js +1 -1
  27. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +2 -3
  28. package/es/components/header/header_links/header_links.js +2 -3
  29. package/es/components/page/page_header/page_header_content.js +2 -3
  30. package/es/components/page/page_sidebar/page_sidebar.js +2 -2
  31. package/es/components/page_template/page_template.js +14 -5
  32. package/es/components/popover/input_popover.js +24 -9
  33. package/es/components/popover/popover.js +4 -6
  34. package/es/components/resizable_container/index.js +2 -1
  35. package/es/components/resizable_container/resizable_button.js +81 -50
  36. package/es/components/resizable_container/resizable_button.styles.js +66 -0
  37. package/es/components/resizable_container/resizable_collapse_button.js +24 -14
  38. package/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
  39. package/es/components/selectable/selectable_list/selectable_list.js +97 -79
  40. package/es/components/steps/step.styles.js +5 -5
  41. package/es/components/tool_tip/icon_tip.js +1 -1
  42. package/es/components/tool_tip/tool_tip.js +4 -14
  43. package/es/components/tool_tip/tool_tip_anchor.js +5 -14
  44. package/es/components/tour/tour_step.js +2 -3
  45. package/es/services/accessibility/html_id_generator.js +19 -3
  46. package/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
  47. package/eui.d.ts +198 -56
  48. package/i18ntokens.json +64 -46
  49. package/lib/components/accordion/accordion.js +82 -35
  50. package/lib/components/auto_sizer/index.js +11 -7
  51. package/lib/components/breadcrumbs/breadcrumb.js +2 -3
  52. package/lib/components/code/code_block_virtualized.js +25 -17
  53. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
  54. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
  55. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
  56. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
  57. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
  58. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
  59. package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
  60. package/lib/components/date_picker/date_picker_range.js +5 -2
  61. package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  62. package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
  63. package/lib/components/empty_prompt/empty_prompt.js +0 -1
  64. package/lib/components/flyout/flyout.js +9 -7
  65. package/lib/components/flyout/flyout_body.js +15 -3
  66. package/lib/components/form/range/dual_range.js +33 -6
  67. package/lib/components/form/range/range.js +14 -6
  68. package/lib/components/form/super_select/super_select.js +1 -1
  69. package/lib/components/page/page_sidebar/page_sidebar.js +1 -1
  70. package/lib/components/page_template/page_template.js +14 -5
  71. package/lib/components/popover/input_popover.js +23 -8
  72. package/lib/components/popover/popover.js +4 -6
  73. package/lib/components/resizable_container/index.js +8 -1
  74. package/lib/components/resizable_container/resizable_button.js +83 -51
  75. package/lib/components/resizable_container/resizable_button.styles.js +71 -0
  76. package/lib/components/resizable_container/resizable_collapse_button.js +24 -14
  77. package/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
  78. package/lib/components/selectable/selectable_list/selectable_list.js +97 -79
  79. package/lib/components/steps/step.styles.js +5 -5
  80. package/lib/components/tool_tip/icon_tip.js +1 -1
  81. package/lib/components/tool_tip/tool_tip.js +4 -14
  82. package/lib/components/tool_tip/tool_tip_anchor.js +5 -13
  83. package/lib/services/accessibility/html_id_generator.js +21 -2
  84. package/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
  85. package/optimize/es/components/accordion/accordion.js +82 -35
  86. package/optimize/es/components/auto_sizer/index.js +1 -1
  87. package/optimize/es/components/code/code_block_virtualized.js +25 -17
  88. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
  89. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
  90. package/optimize/es/components/date_picker/date_picker_range.js +5 -2
  91. package/optimize/es/components/flyout/flyout.js +9 -7
  92. package/optimize/es/components/flyout/flyout_body.js +4 -2
  93. package/optimize/es/components/form/range/dual_range.js +7 -4
  94. package/optimize/es/components/form/range/range.js +5 -4
  95. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -2
  96. package/optimize/es/components/page_template/page_template.js +14 -5
  97. package/optimize/es/components/popover/input_popover.js +13 -8
  98. package/optimize/es/components/popover/popover.js +2 -3
  99. package/optimize/es/components/resizable_container/index.js +2 -1
  100. package/optimize/es/components/resizable_container/resizable_button.js +61 -44
  101. package/optimize/es/components/resizable_container/resizable_button.styles.js +66 -0
  102. package/optimize/es/components/resizable_container/resizable_collapse_button.js +19 -11
  103. package/optimize/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
  104. package/optimize/es/components/selectable/selectable_list/selectable_list.js +97 -79
  105. package/optimize/es/components/steps/step.styles.js +5 -5
  106. package/optimize/es/components/tool_tip/tool_tip.js +3 -13
  107. package/optimize/es/components/tool_tip/tool_tip_anchor.js +4 -8
  108. package/optimize/es/services/accessibility/html_id_generator.js +19 -3
  109. package/optimize/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
  110. package/optimize/lib/components/accordion/accordion.js +82 -35
  111. package/optimize/lib/components/auto_sizer/index.js +11 -7
  112. package/optimize/lib/components/code/code_block_virtualized.js +25 -17
  113. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
  114. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
  115. package/optimize/lib/components/date_picker/date_picker_range.js +5 -2
  116. package/optimize/lib/components/flyout/flyout.js +9 -7
  117. package/optimize/lib/components/flyout/flyout_body.js +4 -2
  118. package/optimize/lib/components/form/range/dual_range.js +7 -4
  119. package/optimize/lib/components/form/range/range.js +5 -4
  120. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +1 -1
  121. package/optimize/lib/components/page_template/page_template.js +14 -5
  122. package/optimize/lib/components/popover/input_popover.js +12 -7
  123. package/optimize/lib/components/popover/popover.js +2 -3
  124. package/optimize/lib/components/resizable_container/index.js +8 -1
  125. package/optimize/lib/components/resizable_container/resizable_button.js +63 -45
  126. package/optimize/lib/components/resizable_container/resizable_button.styles.js +71 -0
  127. package/optimize/lib/components/resizable_container/resizable_collapse_button.js +19 -11
  128. package/optimize/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
  129. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +97 -79
  130. package/optimize/lib/components/steps/step.styles.js +5 -5
  131. package/optimize/lib/components/tool_tip/tool_tip.js +3 -13
  132. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +4 -8
  133. package/optimize/lib/services/accessibility/html_id_generator.js +21 -2
  134. package/optimize/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
  135. package/package.json +19 -21
  136. package/src/components/index.scss +0 -1
  137. package/test-env/components/accordion/accordion.js +82 -35
  138. package/test-env/components/auto_sizer/index.js +11 -7
  139. package/test-env/components/breadcrumbs/breadcrumb.js +2 -3
  140. package/test-env/components/code/code_block_virtualized.js +25 -17
  141. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
  142. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
  143. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
  144. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
  145. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
  146. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
  147. package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
  148. package/test-env/components/date_picker/date_picker_range.js +5 -2
  149. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  150. package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
  151. package/test-env/components/empty_prompt/empty_prompt.js +0 -1
  152. package/test-env/components/flyout/flyout_body.js +15 -3
  153. package/test-env/components/form/range/dual_range.js +33 -6
  154. package/test-env/components/form/range/range.js +14 -6
  155. package/test-env/components/form/super_select/super_select.js +1 -1
  156. package/test-env/components/page/page_sidebar/page_sidebar.js +1 -1
  157. package/test-env/components/page_template/page_template.js +14 -5
  158. package/test-env/components/popover/input_popover.js +23 -8
  159. package/test-env/components/popover/popover.js +4 -6
  160. package/test-env/components/resizable_container/index.js +8 -1
  161. package/test-env/components/resizable_container/resizable_button.js +83 -51
  162. package/test-env/components/resizable_container/resizable_button.styles.js +71 -0
  163. package/test-env/components/resizable_container/resizable_collapse_button.js +19 -14
  164. package/test-env/components/resizable_container/resizable_collapse_button.styles.js +90 -0
  165. package/test-env/components/selectable/selectable_list/selectable_list.js +97 -79
  166. package/test-env/components/steps/step.styles.js +5 -5
  167. package/test-env/components/tool_tip/icon_tip.js +1 -1
  168. package/test-env/components/tool_tip/tool_tip.js +4 -14
  169. package/test-env/components/tool_tip/tool_tip_anchor.js +5 -11
  170. package/test-env/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
  171. package/src/components/resizable_container/_index.scss +0 -3
  172. package/src/components/resizable_container/_resizable_button.scss +0 -129
  173. package/src/components/resizable_container/_resizable_collapse_button.scss +0 -145
  174. package/src/components/resizable_container/_variables.scss +0 -2
@@ -230,8 +230,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
230
230
  top = _findPopoverPosition.top,
231
231
  left = _findPopoverPosition.left,
232
232
  foundPosition = _findPopoverPosition.position,
233
- arrow = _findPopoverPosition.arrow,
234
- anchorBoundingBox = _findPopoverPosition.anchorBoundingBox;
233
+ arrow = _findPopoverPosition.arrow;
235
234
 
236
235
  // the popover's z-index must inherit from the button
237
236
  // this keeps a button's popover under a flyout that would cover the button
@@ -240,7 +239,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
240
239
  var zIndex = zIndexProp == null ? (0, _popover.getElementZIndex)(_this.button, _this.panel) + 2000 : zIndexProp;
241
240
  var popoverStyles = _objectSpread(_objectSpread({}, _this.props.panelStyle), {}, {
242
241
  top: top,
243
- left: _this.props.attachToAnchor && anchorBoundingBox ? anchorBoundingBox.left : left,
242
+ left: left,
244
243
  zIndex: zIndex
245
244
  });
246
245
  var willRenderArrow = !_this.props.attachToAnchor && _this.props.hasArrow;
@@ -562,9 +561,8 @@ EuiPopover.propTypes = {
562
561
  */
563
562
  anchorPosition: _propTypes.default.any,
564
563
  /**
565
- * Style and position alteration for arrow-less, left-aligned
566
- * attachment. Intended for use with inputs as anchors, e.g.
567
- * EuiInputPopover
564
+ * Style and position alteration for arrow-less attachment.
565
+ * Intended for use with inputs as anchors, e.g. EuiInputPopover
568
566
  */
569
567
  attachToAnchor: _propTypes.default.bool,
570
568
  /**
@@ -3,10 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "EuiResizableButton", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _resizable_button.EuiResizableButton;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "EuiResizableContainer", {
7
13
  enumerable: true,
8
14
  get: function get() {
9
15
  return _resizable_container.EuiResizableContainer;
10
16
  }
11
17
  });
12
- var _resizable_container = require("./resizable_container");
18
+ var _resizable_container = require("./resizable_container");
19
+ var _resizable_button = require("./resizable_button");
@@ -4,16 +4,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.EuiResizableButton = void 0;
8
- exports.euiResizableButtonWithControls = euiResizableButtonWithControls;
7
+ exports.euiResizableButtonWithControls = exports.EuiResizableButtonControlled = exports.EuiResizableButton = void 0;
9
8
  var _react = _interopRequireWildcard(require("react"));
10
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
10
  var _classnames = _interopRequireDefault(require("classnames"));
12
11
  var _i18n = require("../i18n");
13
12
  var _services = require("../../services");
14
13
  var _context = require("./context");
14
+ var _resizable_button = require("./resizable_button.styles");
15
15
  var _react2 = require("@emotion/react");
16
- var _excluded = ["isHorizontal", "className", "id", "registration", "disabled", "onFocus", "onBlur"];
16
+ var _excluded = ["isHorizontal", "alignIndicator", "className"],
17
+ _excluded2 = ["registration", "id", "disabled", "onFocus"];
17
18
  /*
18
19
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
20
  * or more contributor license agreements. Licensed under the Elastic License
@@ -33,15 +34,70 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
33
34
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
35
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
35
36
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
36
- var EuiResizableButton = function EuiResizableButton(_ref) {
37
+ /**
38
+ * A generic button for indicating/facilitating resizable content,
39
+ * usable outside of the EuiResizableContainer context
40
+ */
41
+ var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
37
42
  var isHorizontal = _ref.isHorizontal,
43
+ _ref$alignIndicator = _ref.alignIndicator,
44
+ alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
38
45
  className = _ref.className,
39
- id = _ref.id,
40
- registration = _ref.registration,
41
- disabled = _ref.disabled,
42
- onFocus = _ref.onFocus,
43
- onBlur = _ref.onBlur,
44
46
  rest = _objectWithoutProperties(_ref, _excluded);
47
+ var classes = (0, _classnames.default)('euiResizableButton', className);
48
+ var euiTheme = (0, _services.useEuiTheme)();
49
+ var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
50
+ var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
51
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
52
+ tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
53
+ defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
54
+ }, function (_ref2) {
55
+ var _ref3 = _slicedToArray(_ref2, 2),
56
+ horizontalResizerAriaLabel = _ref3[0],
57
+ verticalResizerAriaLabel = _ref3[1];
58
+ return (0, _react2.jsx)("button", _extends({
59
+ ref: ref,
60
+ "aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
61
+ className: classes,
62
+ css: cssStyles,
63
+ "data-test-subj": "euiResizableButton",
64
+ type: "button"
65
+ }, rest));
66
+ });
67
+ });
68
+ exports.EuiResizableButton = EuiResizableButton;
69
+ EuiResizableButton.propTypes = {
70
+ className: _propTypes.default.string,
71
+ "aria-label": _propTypes.default.string,
72
+ "data-test-subj": _propTypes.default.string,
73
+ css: _propTypes.default.any,
74
+ /**
75
+ * Defaults to displaying a resizer for vertical (y-axis) resizing.
76
+ * Set to `true` to display a resizer for horizontal (x-axis) resizing.
77
+ */
78
+ isHorizontal: _propTypes.default.bool,
79
+ /**
80
+ * Specify the alignment of the initial resize indicator. Defaults to `center`,
81
+ * but consider using `start` for extremely tall content that scrolls off-screen
82
+ */
83
+ alignIndicator: _propTypes.default.oneOf(["center", "start", "end"]),
84
+ /**
85
+ * When disabled, the resizer button will be completely hidden
86
+ */
87
+ disabled: _propTypes.default.bool
88
+ };
89
+ EuiResizableButton.displayName = 'EuiResizableButton';
90
+
91
+ /**
92
+ * Resizer button specific to controlled EuiResizableContainer usage
93
+ */
94
+
95
+ var EuiResizableButtonControlled = function EuiResizableButtonControlled(_ref4) {
96
+ var registration = _ref4.registration,
97
+ id = _ref4.id,
98
+ disabled = _ref4.disabled,
99
+ _onFocus = _ref4.onFocus,
100
+ rest = _objectWithoutProperties(_ref4, _excluded2);
45
101
  var resizerId = (0, _services.useGeneratedHtmlId)({
46
102
  prefix: 'resizable-button',
47
103
  conditionalId: id
@@ -53,13 +109,9 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
53
109
  } : _useEuiResizableConta2,
54
110
  resizers = _useEuiResizableConta3.resizers;
55
111
  var isDisabled = (0, _react.useMemo)(function () {
56
- return disabled || resizers[resizerId] && resizers[resizerId].isDisabled;
112
+ var _resizers$resizerId;
113
+ return disabled || ((_resizers$resizerId = resizers[resizerId]) === null || _resizers$resizerId === void 0 ? void 0 : _resizers$resizerId.isDisabled);
57
114
  }, [resizers, resizerId, disabled]);
58
- var classes = (0, _classnames.default)('euiResizableButton', {
59
- 'euiResizableButton--vertical': !isHorizontal,
60
- 'euiResizableButton--horizontal': isHorizontal,
61
- 'euiResizableButton--disabled': isDisabled
62
- }, className);
63
115
  var previousRef = (0, _react.useRef)();
64
116
  var onRef = (0, _react.useCallback)(function (ref) {
65
117
  if (!registration) return;
@@ -78,42 +130,22 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
78
130
  }
79
131
  }
80
132
  }, [registration, resizerId, disabled]);
81
- var setFocus = function setFocus(e) {
82
- return e.currentTarget.focus();
83
- };
84
- var handleFocus = function handleFocus() {
85
- onFocus && onFocus(resizerId);
86
- };
87
- return (0, _react2.jsx)(_i18n.EuiI18n, {
88
- tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
89
- defaults: ['Press left or right to adjust panels size', 'Press up or down to adjust panels size']
90
- }, function (_ref2) {
91
- var _ref3 = _slicedToArray(_ref2, 2),
92
- horizontalResizerAriaLabel = _ref3[0],
93
- verticalResizerAriaLabel = _ref3[1];
94
- return (0, _react2.jsx)("button", _extends({
95
- id: resizerId,
96
- ref: onRef,
97
- "aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
98
- className: classes,
99
- "data-test-subj": "euiResizableButton",
100
- type: "button",
101
- onClick: setFocus,
102
- onFocus: handleFocus,
103
- onBlur: onBlur,
104
- disabled: isDisabled
105
- }, rest));
106
- });
107
- };
108
- exports.EuiResizableButton = EuiResizableButton;
109
- EuiResizableButton.propTypes = {
110
- className: _propTypes.default.string,
111
- "aria-label": _propTypes.default.string,
112
- "data-test-subj": _propTypes.default.string,
113
- css: _propTypes.default.any
133
+ return (0, _react2.jsx)(EuiResizableButton, _extends({
134
+ id: resizerId,
135
+ ref: onRef,
136
+ disabled: isDisabled,
137
+ onClick: function onClick(e) {
138
+ return e.currentTarget.focus();
139
+ },
140
+ onFocus: function onFocus() {
141
+ return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(resizerId);
142
+ }
143
+ }, rest));
114
144
  };
115
- function euiResizableButtonWithControls(controls) {
145
+ exports.EuiResizableButtonControlled = EuiResizableButtonControlled;
146
+ var euiResizableButtonWithControls = function euiResizableButtonWithControls(controls) {
116
147
  return function (props) {
117
- return (0, _react2.jsx)(EuiResizableButton, _extends({}, controls, props));
148
+ return (0, _react2.jsx)(EuiResizableButtonControlled, _extends({}, controls, props));
118
149
  };
119
- }
150
+ };
151
+ exports.euiResizableButtonWithControls = euiResizableButtonWithControls;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiResizableButtonStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _services = require("../../services");
9
+ var _global_styling = require("../../global_styling");
10
+ 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)."; } /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ var _ref = process.env.NODE_ENV === "production" ? {
18
+ name: "1fvu7sv-end",
19
+ styles: "align-items:flex-end;label:end;"
20
+ } : {
21
+ name: "1fvu7sv-end",
22
+ styles: "align-items:flex-end;label:end;",
23
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
24
+ };
25
+ var _ref2 = process.env.NODE_ENV === "production" ? {
26
+ name: "h0ntv8-start",
27
+ styles: "align-items:flex-start;label:start;"
28
+ } : {
29
+ name: "h0ntv8-start",
30
+ styles: "align-items:flex-start;label:start;",
31
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
32
+ };
33
+ var _ref3 = process.env.NODE_ENV === "production" ? {
34
+ name: "8391db-center",
35
+ styles: "align-items:center;label:center;"
36
+ } : {
37
+ name: "8391db-center",
38
+ styles: "align-items:center;label:center;",
39
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
+ };
41
+ var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext) {
42
+ var euiTheme = euiThemeContext.euiTheme;
43
+ var buttonSize = euiTheme.size.base;
44
+ var grabHandleWidth = euiTheme.size.m;
45
+ var grabHandleHeight = euiTheme.border.width.thin;
46
+ var transitionSpeed = euiTheme.animation.fast;
47
+ var transition = "".concat(transitionSpeed, " ease");
48
+ return {
49
+ // Mimics the "grab" icon with CSS psuedo-elements.
50
+ // 1. The "grab" icon transforms into a thicker straight line on :hover and :focus
51
+ // 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
52
+ // 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
53
+ euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;gap:", (0, _global_styling.mathWithUnits)(grabHandleHeight, function (x) {
54
+ return x * 2;
55
+ }), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
56
+ return x / 2;
57
+ }), ";}}};label:euiResizableButton;"),
58
+ horizontal: /*#__PURE__*/(0, _react.css)("cursor:col-resize;", (0, _global_styling.logicalCSS)('height', '100%'), " ", (0, _global_styling.logicalCSS)('width', buttonSize), " margin-inline:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
59
+ return x / -2;
60
+ }), ";&::before,&::after{", (0, _global_styling.logicalCSS)('width', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
61
+ vertical: /*#__PURE__*/(0, _react.css)("flex-direction:column;cursor:row-resize;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', buttonSize), " margin-block:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
62
+ return x / -2;
63
+ }), ";&::before,&::after{", (0, _global_styling.logicalCSS)('height', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;"),
64
+ alignIndicator: {
65
+ center: _ref3,
66
+ start: _ref2,
67
+ end: _ref
68
+ }
69
+ };
70
+ };
71
+ exports.euiResizableButtonStyles = euiResizableButtonStyles;
@@ -7,7 +7,10 @@ exports.EuiResizableCollapseButton = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _services = require("../../services");
10
11
  var _button = require("../button");
12
+ var _screen_reader_only = require("../accessibility/screen_reader_only/screen_reader_only.styles");
13
+ var _resizable_collapse_button = require("./resizable_collapse_button.styles");
11
14
  var _react2 = require("@emotion/react");
12
15
  var _excluded = ["className", "externalPosition", "internalPosition", "direction", "isVisible", "isCollapsed"];
13
16
  /*
@@ -19,11 +22,18 @@ var _excluded = ["className", "externalPosition", "internalPosition", "direction
19
22
  */
20
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
24
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
26
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
28
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
29
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
30
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
31
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
32
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
33
  var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
25
34
  var className = _ref.className,
26
- externalPosition = _ref.externalPosition,
35
+ _ref$externalPosition = _ref.externalPosition,
36
+ externalPosition = _ref$externalPosition === void 0 ? 'before' : _ref$externalPosition,
27
37
  _ref$internalPosition = _ref.internalPosition,
28
38
  internalPosition = _ref$internalPosition === void 0 ? 'middle' : _ref$internalPosition,
29
39
  _ref$direction = _ref.direction,
@@ -32,14 +42,15 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
32
42
  isCollapsed = _ref.isCollapsed,
33
43
  rest = _objectWithoutProperties(_ref, _excluded);
34
44
  var isHorizontal = direction === 'horizontal';
35
- var classes = (0, _classnames.default)('euiResizableToggleButton', "euiResizableToggleButton--".concat(direction), "euiResizableToggleButton--".concat(externalPosition), "euiResizableToggleButton--".concat(internalPosition), {
36
- 'euiResizableToggleButton-isVisible': isVisible,
37
- 'euiResizableToggleButton-isCollapsed': isCollapsed
38
- }, className);
39
-
40
- // Default to simiple grab icon in case there is no externalPosition specified
41
- var COLLAPSED_ICON = isHorizontal ? 'grab' : 'grabHorizontal';
42
- var NOT_COLLAPSED_ICON = isHorizontal ? 'grab' : 'grabHorizontal';
45
+ var showOnFocus = !isCollapsed && !isVisible;
46
+ var screenReaderOnlyStyles = (0, _screen_reader_only.euiScreenReaderOnlyStyles)(showOnFocus).euiScreenReaderOnly;
47
+ var euiTheme = (0, _services.useEuiTheme)();
48
+ var styles = (0, _resizable_collapse_button.euiResizableCollapseButtonStyles)(euiTheme);
49
+ var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
50
+ var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
51
+ var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat(_toConsumableArray(isCollapsed ? collapsedStyles : collapsibleStyles));
52
+ var COLLAPSED_ICON = '';
53
+ var NOT_COLLAPSED_ICON = '';
43
54
  switch (externalPosition) {
44
55
  case 'before':
45
56
  COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
@@ -50,11 +61,13 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
50
61
  NOT_COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
51
62
  break;
52
63
  }
64
+ var classes = (0, _classnames.default)('euiResizableCollapseButton', className);
53
65
  return (0, _react2.jsx)(_button.EuiButtonIcon, _extends({
54
66
  display: isCollapsed ? 'empty' : 'base',
55
- color: "text"
56
- }, rest, {
67
+ color: "text",
57
68
  className: classes,
69
+ css: cssStyles
70
+ }, rest, {
58
71
  iconType: isCollapsed ? COLLAPSED_ICON : NOT_COLLAPSED_ICON
59
72
  }));
60
73
  };
@@ -74,9 +87,6 @@ EuiResizableCollapseButton.propTypes = {
74
87
  * Same direction derived from EuiResizableContainer
75
88
  */
76
89
  direction: _propTypes.default.oneOf(["vertical", "horizontal"]),
77
- /**
78
- *
79
- */
80
90
  isVisible: _propTypes.default.bool,
81
91
  isCollapsed: _propTypes.default.bool
82
92
  };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiResizableCollapseButtonStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _global_styling = require("../../global_styling");
9
+ var _amsterdam = require("../../themes/amsterdam");
10
+ 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)."; } /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ var _ref = process.env.NODE_ENV === "production" ? {
18
+ name: "fuwsll-euiResizableCollapseButton",
19
+ styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;"
20
+ } : {
21
+ name: "fuwsll-euiResizableCollapseButton",
22
+ styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;",
23
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
24
+ };
25
+ var euiResizableCollapseButtonStyles = function euiResizableCollapseButtonStyles(euiThemeContext) {
26
+ var euiTheme = euiThemeContext.euiTheme;
27
+ var buttonSize = euiTheme.size.l;
28
+ var centeringOffset = (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
29
+ return x / -2;
30
+ }); // Use negative margins instead of transforms to avoid having to override EuiButtonIcon's CSS
31
+ var buttonOffset = euiTheme.size.base;
32
+ return {
33
+ euiResizableCollapseButton: _ref,
34
+ collapsible: {
35
+ collapsible: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.emptyShade, ";", (0, _amsterdam.euiShadowXSmall)(euiThemeContext), " &:focus{", (0, _amsterdam.euiSlightShadowHover)(euiThemeContext), ";};label:collapsible;"),
36
+ horizontal: {
37
+ after: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('margin-right', centeringOffset), ";;label:after;"),
38
+ before: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('margin-left', centeringOffset), ";;label:before;"),
39
+ middle: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', '50%'), " ", (0, _global_styling.logicalCSS)('margin-top', centeringOffset), ";;label:middle;"),
40
+ top: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', 0), " ", (0, _global_styling.logicalCSS)('margin-top', buttonOffset), ";;label:top;"),
41
+ bottom: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('margin-bottom', buttonOffset), ";;label:bottom;"),
42
+ // `left/right` aren't valid positions for the horizontal direction,
43
+ // so we're using getters to fall back to the `middle` CSS
44
+ get left() {
45
+ return this.middle;
46
+ },
47
+ get right() {
48
+ return this.middle;
49
+ }
50
+ },
51
+ vertical: {
52
+ after: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', '100%'), " ", (0, _global_styling.logicalCSS)('margin-top', centeringOffset), ";;label:after;"),
53
+ before: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('bottom', '100%'), " ", (0, _global_styling.logicalCSS)('margin-bottom', centeringOffset), ";;label:before;"),
54
+ middle: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', '50%'), " ", (0, _global_styling.logicalCSS)('margin-left', centeringOffset), ";;label:middle;"),
55
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('margin-left', buttonOffset), ";;label:left;"),
56
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('margin-right', buttonOffset), ";;label:right;"),
57
+ // `top/bottom` aren't valid positions for the horizontal direction,
58
+ // so we're using getters to fall back to the `middle` CSS
59
+ get top() {
60
+ return this.middle;
61
+ },
62
+ get bottom() {
63
+ return this.middle;
64
+ }
65
+ }
66
+ },
67
+ collapsed: {
68
+ // When collapsed, the button itself is the full collapsed area
69
+ // and we use flex to align the icon within
70
+ collapsed: /*#__PURE__*/(0, _react.css)("border-radius:0;", (0, _global_styling.logicalCSS)('top', 0), ";;label:collapsed;"),
71
+ horizontal: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";;label:horizontal;"),
72
+ vertical: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), ";;label:vertical;"),
73
+ horizontalPositions: {
74
+ top: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', buttonOffset), " align-items:flex-start;;label:top;"),
75
+ bottom: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-bottom', buttonOffset), " align-items:flex-end;;label:bottom;"),
76
+ middle: /*#__PURE__*/(0, _react.css)(";label:middle;"),
77
+ left: /*#__PURE__*/(0, _react.css)(";label:left;"),
78
+ right: /*#__PURE__*/(0, _react.css)(";label:right;")
79
+ },
80
+ verticalPositions: {
81
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', buttonOffset), " justify-content:flex-start;;label:left;"),
82
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-right', buttonOffset), " justify-content:flex-end;;label:right;"),
83
+ middle: /*#__PURE__*/(0, _react.css)(";label:middle;"),
84
+ top: /*#__PURE__*/(0, _react.css)(";label:top;"),
85
+ bottom: /*#__PURE__*/(0, _react.css)(";label:bottom;")
86
+ }
87
+ }
88
+ };
89
+ };
90
+ exports.euiResizableCollapseButtonStyles = euiResizableCollapseButtonStyles;