@elastic/eui 77.1.0 → 77.1.1
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/index.js +0 -1
- package/eui.d.ts +1 -119
- package/i18ntokens.json +0 -36
- package/lib/components/index.js +0 -11
- package/optimize/es/components/index.js +0 -1
- package/optimize/lib/components/index.js +0 -11
- package/package.json +1 -1
- package/test-env/components/index.js +0 -11
- package/es/components/inline_edit/index.js +0 -10
- package/es/components/inline_edit/inline_edit.styles.js +0 -15
- package/es/components/inline_edit/inline_edit_form.js +0 -190
- package/es/components/inline_edit/inline_edit_text.js +0 -97
- package/es/components/inline_edit/inline_edit_title.js +0 -105
- package/lib/components/inline_edit/index.js +0 -19
- package/lib/components/inline_edit/inline_edit.styles.js +0 -22
- package/lib/components/inline_edit/inline_edit_form.js +0 -193
- package/lib/components/inline_edit/inline_edit_text.js +0 -97
- package/lib/components/inline_edit/inline_edit_title.js +0 -106
- package/optimize/es/components/inline_edit/index.js +0 -10
- package/optimize/es/components/inline_edit/inline_edit.styles.js +0 -15
- package/optimize/es/components/inline_edit/inline_edit_form.js +0 -133
- package/optimize/es/components/inline_edit/inline_edit_text.js +0 -52
- package/optimize/es/components/inline_edit/inline_edit_title.js +0 -56
- package/optimize/lib/components/inline_edit/index.js +0 -19
- package/optimize/lib/components/inline_edit/inline_edit.styles.js +0 -22
- package/optimize/lib/components/inline_edit/inline_edit_form.js +0 -144
- package/optimize/lib/components/inline_edit/inline_edit_text.js +0 -52
- package/optimize/lib/components/inline_edit/inline_edit_title.js +0 -57
- package/test-env/components/inline_edit/index.js +0 -19
- package/test-env/components/inline_edit/inline_edit.styles.js +0 -22
- package/test-env/components/inline_edit/inline_edit_form.js +0 -196
- package/test-env/components/inline_edit/inline_edit_text.js +0 -96
- package/test-env/components/inline_edit/inline_edit_title.js +0 -105
package/es/components/index.js
CHANGED
package/eui.d.ts
CHANGED
|
@@ -2582,8 +2582,7 @@ declare module '@elastic/eui/src/components/button/button_empty/button_empty' {
|
|
|
2582
2582
|
* Object of props passed to the <span/> wrapping the button's content
|
|
2583
2583
|
*/
|
|
2584
2584
|
contentProps?: CommonProps & EuiButtonContentType;
|
|
2585
|
-
} type EuiButtonEmptyPropsForAnchor = PropsForAnchor<CommonEuiButtonEmptyProps>;
|
|
2586
|
-
export type EuiButtonEmptyPropsForButton = PropsForButton<CommonEuiButtonEmptyProps>;
|
|
2585
|
+
} type EuiButtonEmptyPropsForAnchor = PropsForAnchor<CommonEuiButtonEmptyProps>; type EuiButtonEmptyPropsForButton = PropsForButton<CommonEuiButtonEmptyProps>;
|
|
2587
2586
|
export type EuiButtonEmptyProps = ExclusiveUnion<EuiButtonEmptyPropsForAnchor, EuiButtonEmptyPropsForButton>;
|
|
2588
2587
|
export const EuiButtonEmpty: FunctionComponent<EuiButtonEmptyProps>;
|
|
2589
2588
|
export {};
|
|
@@ -15621,113 +15620,6 @@ declare module '@elastic/eui/src/components/image' {
|
|
|
15621
15620
|
export type { EuiImageProps } from '@elastic/eui/src/components/image/image_types';
|
|
15622
15621
|
export { EuiImage } from '@elastic/eui/src/components/image/image';
|
|
15623
15622
|
|
|
15624
|
-
}
|
|
15625
|
-
declare module '@elastic/eui/src/components/inline_edit/inline_edit_form' {
|
|
15626
|
-
import { ReactNode, FunctionComponent } from 'react';
|
|
15627
|
-
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
15628
|
-
import { EuiFieldTextProps } from '@elastic/eui/src/components/form';
|
|
15629
|
-
import { EuiButtonEmptyProps } from '@elastic/eui/src/components/button';
|
|
15630
|
-
import { EuiButtonEmptyPropsForButton } from '@elastic/eui/src/components/button/button_empty/button_empty';
|
|
15631
|
-
export type EuiInlineEditCommonProps = CommonProps & {
|
|
15632
|
-
defaultValue: string;
|
|
15633
|
-
/**
|
|
15634
|
-
* Allow users to pass in a function that is called when the confirm button is clicked
|
|
15635
|
-
* The function should return a boolean flag that will determine if the value will be saved.
|
|
15636
|
-
* When the flag is true, the value will be saved. When the flag is false, the user will be
|
|
15637
|
-
* returned to editMode.
|
|
15638
|
-
*/
|
|
15639
|
-
onConfirm?: () => boolean;
|
|
15640
|
-
/**
|
|
15641
|
-
* Form label that appears above the form control
|
|
15642
|
-
* This is required for accessibility because there is no visual label on the input
|
|
15643
|
-
*/
|
|
15644
|
-
inputAriaLabel: string;
|
|
15645
|
-
/**
|
|
15646
|
-
* Aria-label for save button in editMode
|
|
15647
|
-
*/
|
|
15648
|
-
saveButtonAriaLabel?: string;
|
|
15649
|
-
/**
|
|
15650
|
-
* Aria-label for cancel button in editMode
|
|
15651
|
-
*/
|
|
15652
|
-
cancelButtonAriaLabel?: string;
|
|
15653
|
-
/**
|
|
15654
|
-
* Start in editMode
|
|
15655
|
-
*/
|
|
15656
|
-
startWithEditOpen?: boolean;
|
|
15657
|
-
/**
|
|
15658
|
-
* Props that will be applied directly to the EuiEmptyButton displayed in readMode
|
|
15659
|
-
*/
|
|
15660
|
-
readModeProps?: Omit<EuiButtonEmptyPropsForButton, 'onClick'>;
|
|
15661
|
-
/**
|
|
15662
|
-
* Props that will be applied directly to the EuiFieldText displayed in editMode
|
|
15663
|
-
*/
|
|
15664
|
-
editModeProps?: EuiFieldTextProps;
|
|
15665
|
-
};
|
|
15666
|
-
export type EuiInlineEditFormProps = EuiInlineEditCommonProps & {
|
|
15667
|
-
/**
|
|
15668
|
-
* Form sizes
|
|
15669
|
-
*/
|
|
15670
|
-
sizes: {
|
|
15671
|
-
compressed: boolean;
|
|
15672
|
-
buttonSize: EuiButtonEmptyProps['size'];
|
|
15673
|
-
iconSize: EuiButtonEmptyProps['iconSize'];
|
|
15674
|
-
};
|
|
15675
|
-
/**
|
|
15676
|
-
* Render prop that returns the read mode value as an arg
|
|
15677
|
-
*/
|
|
15678
|
-
children: (readModeValue: ReactNode) => ReactNode;
|
|
15679
|
-
};
|
|
15680
|
-
export const SMALL_SIZE_FORM: {
|
|
15681
|
-
readonly iconSize: "s";
|
|
15682
|
-
readonly compressed: true;
|
|
15683
|
-
readonly buttonSize: "s";
|
|
15684
|
-
};
|
|
15685
|
-
export const MEDIUM_SIZE_FORM: {
|
|
15686
|
-
readonly iconSize: "m";
|
|
15687
|
-
readonly compressed: false;
|
|
15688
|
-
readonly buttonSize: "m";
|
|
15689
|
-
};
|
|
15690
|
-
export const EuiInlineEditForm: FunctionComponent<EuiInlineEditFormProps>;
|
|
15691
|
-
|
|
15692
|
-
}
|
|
15693
|
-
declare module '@elastic/eui/src/components/inline_edit/inline_edit_text' {
|
|
15694
|
-
import { FunctionComponent } from 'react';
|
|
15695
|
-
import { EuiTextProps } from '@elastic/eui/src/components/text';
|
|
15696
|
-
import { EuiInlineEditCommonProps } from '@elastic/eui/src/components/inline_edit/inline_edit_form';
|
|
15697
|
-
export type EuiInlineEditTextSizes = Exclude<EuiTextProps['size'], 'relative'>;
|
|
15698
|
-
export type EuiInlineEditTextProps = EuiInlineEditCommonProps & {
|
|
15699
|
-
/**
|
|
15700
|
-
* Text size level
|
|
15701
|
-
*/
|
|
15702
|
-
size?: EuiInlineEditTextSizes;
|
|
15703
|
-
};
|
|
15704
|
-
export const EuiInlineEditText: FunctionComponent<EuiInlineEditTextProps>;
|
|
15705
|
-
|
|
15706
|
-
}
|
|
15707
|
-
declare module '@elastic/eui/src/components/inline_edit/inline_edit_title' {
|
|
15708
|
-
import { FunctionComponent } from 'react';
|
|
15709
|
-
import { EuiTitleSize } from '@elastic/eui/src/components/title';
|
|
15710
|
-
import { EuiInlineEditCommonProps } from '@elastic/eui/src/components/inline_edit/inline_edit_form';
|
|
15711
|
-
export const HEADINGS: readonly ["h1", "h2", "h3", "h4", "h5", "h6"]; type Heading = typeof HEADINGS[number];
|
|
15712
|
-
export type EuiInlineEditTitleProps = EuiInlineEditCommonProps & {
|
|
15713
|
-
/**
|
|
15714
|
-
* Title size level
|
|
15715
|
-
*/
|
|
15716
|
-
size?: EuiTitleSize;
|
|
15717
|
-
/**
|
|
15718
|
-
* Level of heading to be used for the title
|
|
15719
|
-
*/
|
|
15720
|
-
heading: Heading;
|
|
15721
|
-
};
|
|
15722
|
-
export const EuiInlineEditTitle: FunctionComponent<EuiInlineEditTitleProps>;
|
|
15723
|
-
export {};
|
|
15724
|
-
|
|
15725
|
-
}
|
|
15726
|
-
declare module '@elastic/eui/src/components/inline_edit' {
|
|
15727
|
-
export { EuiInlineEditText } from '@elastic/eui/src/components/inline_edit/inline_edit_text';
|
|
15728
|
-
export { EuiInlineEditTitle } from '@elastic/eui/src/components/inline_edit/inline_edit_title';
|
|
15729
|
-
export type { EuiInlineEditTextSizes } from '@elastic/eui/src/components/inline_edit/inline_edit_text';
|
|
15730
|
-
|
|
15731
15623
|
}
|
|
15732
15624
|
declare module '@elastic/eui/src/components/key_pad_menu/key_pad_menu.styles' {
|
|
15733
15625
|
import { UseEuiTheme } from '@elastic/eui/src/services';
|
|
@@ -21487,7 +21379,6 @@ declare module '@elastic/eui/src/components' {
|
|
|
21487
21379
|
export * from '@elastic/eui/src/components/icon';
|
|
21488
21380
|
export * from '@elastic/eui/src/components/image';
|
|
21489
21381
|
export * from '@elastic/eui/src/components/inner_text';
|
|
21490
|
-
export * from '@elastic/eui/src/components/inline_edit';
|
|
21491
21382
|
export * from '@elastic/eui/src/components/i18n';
|
|
21492
21383
|
export * from '@elastic/eui/src/components/loading';
|
|
21493
21384
|
export * from '@elastic/eui/src/components/key_pad_menu';
|
|
@@ -26231,13 +26122,6 @@ declare module '@elastic/eui/src/components/icon/assets/wrench' {
|
|
|
26231
26122
|
export const icon: ({ title, titleId, ...props }: React.SVGProps<SVGSVGElement> & SVGRProps) => JSX.Element;
|
|
26232
26123
|
export {};
|
|
26233
26124
|
|
|
26234
|
-
}
|
|
26235
|
-
declare module '@elastic/eui/src/components/inline_edit/inline_edit.styles' {
|
|
26236
|
-
import { UseEuiTheme } from '@elastic/eui/src/services';
|
|
26237
|
-
export const euiInlineEditStyles: ({ euiTheme }: UseEuiTheme) => {
|
|
26238
|
-
euiInlineEdit: import("@emotion/utils").SerializedStyles;
|
|
26239
|
-
};
|
|
26240
|
-
|
|
26241
26125
|
}
|
|
26242
26126
|
/*
|
|
26243
26127
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -26582,8 +26466,6 @@ declare module '@elastic/eui' {
|
|
|
26582
26466
|
"euiHeaderLinks.appNavigation": any;
|
|
26583
26467
|
"euiImageButton.openFullScreen": any;
|
|
26584
26468
|
"euiImageButton.closeFullScreen": any;
|
|
26585
|
-
"euiInlineEditForm.saveButtonAriaLabel": any;
|
|
26586
|
-
"euiInlineEditForm.cancelButtonAriaLabel": any;
|
|
26587
26469
|
"euiLink.newTarget.screenReaderOnlyText": any;
|
|
26588
26470
|
"euiLink.external.ariaLabel": any;
|
|
26589
26471
|
"euiPinnableListGroup.pinExtraActionLabel": any;
|
package/i18ntokens.json
CHANGED
|
@@ -4967,42 +4967,6 @@
|
|
|
4967
4967
|
},
|
|
4968
4968
|
"filepath": "src/components/image/image_button.tsx"
|
|
4969
4969
|
},
|
|
4970
|
-
{
|
|
4971
|
-
"token": "euiInlineEditForm.saveButtonAriaLabel",
|
|
4972
|
-
"defString": "Save edit",
|
|
4973
|
-
"highlighting": "string",
|
|
4974
|
-
"loc": {
|
|
4975
|
-
"start": {
|
|
4976
|
-
"line": 105,
|
|
4977
|
-
"column": 37,
|
|
4978
|
-
"index": 3359
|
|
4979
|
-
},
|
|
4980
|
-
"end": {
|
|
4981
|
-
"line": 108,
|
|
4982
|
-
"column": 3,
|
|
4983
|
-
"index": 3435
|
|
4984
|
-
}
|
|
4985
|
-
},
|
|
4986
|
-
"filepath": "src/components/inline_edit/inline_edit_form.tsx"
|
|
4987
|
-
},
|
|
4988
|
-
{
|
|
4989
|
-
"token": "euiInlineEditForm.cancelButtonAriaLabel",
|
|
4990
|
-
"defString": "Cancel edit",
|
|
4991
|
-
"highlighting": "string",
|
|
4992
|
-
"loc": {
|
|
4993
|
-
"start": {
|
|
4994
|
-
"line": 109,
|
|
4995
|
-
"column": 39,
|
|
4996
|
-
"index": 3476
|
|
4997
|
-
},
|
|
4998
|
-
"end": {
|
|
4999
|
-
"line": 112,
|
|
5000
|
-
"column": 3,
|
|
5001
|
-
"index": 3556
|
|
5002
|
-
}
|
|
5003
|
-
},
|
|
5004
|
-
"filepath": "src/components/inline_edit/inline_edit_form.tsx"
|
|
5005
|
-
},
|
|
5006
4970
|
{
|
|
5007
4971
|
"token": "euiLink.newTarget.screenReaderOnlyText",
|
|
5008
4972
|
"defString": "(opens in a new tab or window)",
|
package/lib/components/index.js
CHANGED
|
@@ -476,17 +476,6 @@ Object.keys(_inner_text).forEach(function (key) {
|
|
|
476
476
|
}
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
|
-
var _inline_edit = require("./inline_edit");
|
|
480
|
-
Object.keys(_inline_edit).forEach(function (key) {
|
|
481
|
-
if (key === "default" || key === "__esModule") return;
|
|
482
|
-
if (key in exports && exports[key] === _inline_edit[key]) return;
|
|
483
|
-
Object.defineProperty(exports, key, {
|
|
484
|
-
enumerable: true,
|
|
485
|
-
get: function get() {
|
|
486
|
-
return _inline_edit[key];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
479
|
var _i18n = require("./i18n");
|
|
491
480
|
Object.keys(_i18n).forEach(function (key) {
|
|
492
481
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -476,17 +476,6 @@ Object.keys(_inner_text).forEach(function (key) {
|
|
|
476
476
|
}
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
|
-
var _inline_edit = require("./inline_edit");
|
|
480
|
-
Object.keys(_inline_edit).forEach(function (key) {
|
|
481
|
-
if (key === "default" || key === "__esModule") return;
|
|
482
|
-
if (key in exports && exports[key] === _inline_edit[key]) return;
|
|
483
|
-
Object.defineProperty(exports, key, {
|
|
484
|
-
enumerable: true,
|
|
485
|
-
get: function get() {
|
|
486
|
-
return _inline_edit[key];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
479
|
var _i18n = require("./i18n");
|
|
491
480
|
Object.keys(_i18n).forEach(function (key) {
|
|
492
481
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -476,17 +476,6 @@ Object.keys(_inner_text).forEach(function (key) {
|
|
|
476
476
|
}
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
|
-
var _inline_edit = require("./inline_edit");
|
|
480
|
-
Object.keys(_inline_edit).forEach(function (key) {
|
|
481
|
-
if (key === "default" || key === "__esModule") return;
|
|
482
|
-
if (key in exports && exports[key] === _inline_edit[key]) return;
|
|
483
|
-
Object.defineProperty(exports, key, {
|
|
484
|
-
enumerable: true,
|
|
485
|
-
get: function get() {
|
|
486
|
-
return _inline_edit[key];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
479
|
var _i18n = require("./i18n");
|
|
491
480
|
Object.keys(_i18n).forEach(function (key) {
|
|
492
481
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
-
* Side Public License, v 1.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export { EuiInlineEditText } from './inline_edit_text';
|
|
10
|
-
export { EuiInlineEditTitle } from './inline_edit_title';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
-
* Side Public License, v 1.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { css } from '@emotion/react';
|
|
10
|
-
export var euiInlineEditStyles = function euiInlineEditStyles(_ref) {
|
|
11
|
-
var euiTheme = _ref.euiTheme;
|
|
12
|
-
return {
|
|
13
|
-
euiInlineEdit: /*#__PURE__*/css("color:", euiTheme.colors.primaryText, ";;label:euiInlineEdit;")
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
-
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."); }
|
|
4
|
-
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); }
|
|
5
|
-
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; }
|
|
6
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
/*
|
|
9
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
-
* Side Public License, v 1.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import React, { useState } from 'react';
|
|
17
|
-
import PropTypes from "prop-types";
|
|
18
|
-
import classNames from 'classnames';
|
|
19
|
-
import { EuiFormRow, EuiFieldText, EuiForm } from '../form';
|
|
20
|
-
import { EuiButtonIcon, EuiButtonEmpty } from '../button';
|
|
21
|
-
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
22
|
-
import { useEuiI18n } from '../i18n';
|
|
23
|
-
import { useGeneratedHtmlId } from '../../services/accessibility';
|
|
24
|
-
|
|
25
|
-
// Props shared between the internal form component as well as consumer-facing components
|
|
26
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
|
-
export var SMALL_SIZE_FORM = {
|
|
28
|
-
iconSize: 's',
|
|
29
|
-
compressed: true,
|
|
30
|
-
buttonSize: 's'
|
|
31
|
-
};
|
|
32
|
-
export var MEDIUM_SIZE_FORM = {
|
|
33
|
-
iconSize: 'm',
|
|
34
|
-
compressed: false,
|
|
35
|
-
buttonSize: 'm'
|
|
36
|
-
};
|
|
37
|
-
export var EuiInlineEditForm = function EuiInlineEditForm(_ref) {
|
|
38
|
-
var className = _ref.className,
|
|
39
|
-
children = _ref.children,
|
|
40
|
-
sizes = _ref.sizes,
|
|
41
|
-
defaultValue = _ref.defaultValue,
|
|
42
|
-
onConfirm = _ref.onConfirm,
|
|
43
|
-
inputAriaLabel = _ref.inputAriaLabel,
|
|
44
|
-
saveButtonAriaLabel = _ref.saveButtonAriaLabel,
|
|
45
|
-
cancelButtonAriaLabel = _ref.cancelButtonAriaLabel,
|
|
46
|
-
startWithEditOpen = _ref.startWithEditOpen,
|
|
47
|
-
readModeProps = _ref.readModeProps,
|
|
48
|
-
editModeProps = _ref.editModeProps;
|
|
49
|
-
var classes = classNames('euiInlineEdit', className);
|
|
50
|
-
|
|
51
|
-
// Styles to come later! (Styling editMode text to match the size of its readMode counterpart)
|
|
52
|
-
/*const theme = useEuiTheme();
|
|
53
|
-
const styles = euiInlineEditStyles(theme);
|
|
54
|
-
const cssStyles = [styles.euiInlineEdit];*/
|
|
55
|
-
|
|
56
|
-
var defaultSaveButtonAriaLabel = useEuiI18n('euiInlineEditForm.saveButtonAriaLabel', 'Save edit');
|
|
57
|
-
var defaultCancelButtonAriaLabel = useEuiI18n('euiInlineEditForm.cancelButtonAriaLabel', 'Cancel edit');
|
|
58
|
-
var _useState = useState(false || startWithEditOpen),
|
|
59
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
-
isEditing = _useState2[0],
|
|
61
|
-
setIsEditing = _useState2[1];
|
|
62
|
-
var inlineEditInputId = useGeneratedHtmlId({
|
|
63
|
-
prefix: '__inlineEditInput'
|
|
64
|
-
});
|
|
65
|
-
var _useState3 = useState(defaultValue),
|
|
66
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
-
editModeValue = _useState4[0],
|
|
68
|
-
setEditModeValue = _useState4[1];
|
|
69
|
-
var _useState5 = useState(defaultValue),
|
|
70
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
-
readModeValue = _useState6[0],
|
|
72
|
-
setReadModeValue = _useState6[1];
|
|
73
|
-
var cancelInlineEdit = function cancelInlineEdit() {
|
|
74
|
-
setEditModeValue(readModeValue);
|
|
75
|
-
setIsEditing(!isEditing);
|
|
76
|
-
};
|
|
77
|
-
var saveInlineEditValue = function saveInlineEditValue() {
|
|
78
|
-
if (editModeValue && onConfirm && !onConfirm()) {
|
|
79
|
-
// If there is text, an onConfirm method is present, and it has returned false, cancel the action
|
|
80
|
-
return;
|
|
81
|
-
} else if (editModeValue) {
|
|
82
|
-
setReadModeValue(editModeValue);
|
|
83
|
-
setIsEditing(!isEditing);
|
|
84
|
-
} else {
|
|
85
|
-
// If there's no text, cancel the action, reset the input text, and return to readMode
|
|
86
|
-
cancelInlineEdit();
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
var editModeForm = ___EmotionJSX(EuiForm, {
|
|
90
|
-
fullWidth: true
|
|
91
|
-
}, ___EmotionJSX(EuiFlexGroup, {
|
|
92
|
-
gutterSize: "s"
|
|
93
|
-
}, ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiFieldText, _extends({
|
|
94
|
-
id: inlineEditInputId,
|
|
95
|
-
value: editModeValue,
|
|
96
|
-
onChange: function onChange(e) {
|
|
97
|
-
setEditModeValue(e.target.value);
|
|
98
|
-
},
|
|
99
|
-
"aria-label": inputAriaLabel,
|
|
100
|
-
autoFocus: true,
|
|
101
|
-
compressed: sizes.compressed
|
|
102
|
-
}, editModeProps))), ___EmotionJSX(EuiFlexItem, {
|
|
103
|
-
grow: false,
|
|
104
|
-
className: classes
|
|
105
|
-
}, ___EmotionJSX(EuiFormRow, null, ___EmotionJSX(EuiButtonIcon, {
|
|
106
|
-
iconType: "check",
|
|
107
|
-
"aria-label": saveButtonAriaLabel || defaultSaveButtonAriaLabel,
|
|
108
|
-
onClick: saveInlineEditValue,
|
|
109
|
-
color: "success",
|
|
110
|
-
display: "base",
|
|
111
|
-
size: sizes.buttonSize,
|
|
112
|
-
iconSize: sizes.iconSize
|
|
113
|
-
}))), ___EmotionJSX(EuiFlexItem, {
|
|
114
|
-
grow: false
|
|
115
|
-
}, ___EmotionJSX(EuiFormRow, null, ___EmotionJSX(EuiButtonIcon, {
|
|
116
|
-
iconType: "cross",
|
|
117
|
-
"aria-label": cancelButtonAriaLabel || defaultCancelButtonAriaLabel,
|
|
118
|
-
onClick: cancelInlineEdit,
|
|
119
|
-
color: "danger",
|
|
120
|
-
display: "base",
|
|
121
|
-
size: sizes.buttonSize,
|
|
122
|
-
iconSize: sizes.iconSize
|
|
123
|
-
})))));
|
|
124
|
-
var readModeElement = ___EmotionJSX(EuiButtonEmpty, _extends({
|
|
125
|
-
color: "text",
|
|
126
|
-
iconType: "pencil",
|
|
127
|
-
iconSide: "right",
|
|
128
|
-
autoFocus: true,
|
|
129
|
-
flush: "both",
|
|
130
|
-
iconSize: sizes.iconSize,
|
|
131
|
-
size: sizes.buttonSize,
|
|
132
|
-
onClick: function onClick() {
|
|
133
|
-
setIsEditing(!isEditing);
|
|
134
|
-
}
|
|
135
|
-
}, readModeProps), children(readModeValue));
|
|
136
|
-
return ___EmotionJSX("div", {
|
|
137
|
-
className: classes
|
|
138
|
-
}, isEditing ? editModeForm : readModeElement);
|
|
139
|
-
};
|
|
140
|
-
EuiInlineEditForm.propTypes = {
|
|
141
|
-
className: PropTypes.string,
|
|
142
|
-
"aria-label": PropTypes.string,
|
|
143
|
-
"data-test-subj": PropTypes.string,
|
|
144
|
-
css: PropTypes.any,
|
|
145
|
-
defaultValue: PropTypes.string.isRequired,
|
|
146
|
-
/**
|
|
147
|
-
* Allow users to pass in a function that is called when the confirm button is clicked
|
|
148
|
-
* The function should return a boolean flag that will determine if the value will be saved.
|
|
149
|
-
* When the flag is true, the value will be saved. When the flag is false, the user will be
|
|
150
|
-
* returned to editMode.
|
|
151
|
-
*/
|
|
152
|
-
onConfirm: PropTypes.func,
|
|
153
|
-
/**
|
|
154
|
-
* Form label that appears above the form control
|
|
155
|
-
* This is required for accessibility because there is no visual label on the input
|
|
156
|
-
*/
|
|
157
|
-
inputAriaLabel: PropTypes.string.isRequired,
|
|
158
|
-
/**
|
|
159
|
-
* Aria-label for save button in editMode
|
|
160
|
-
*/
|
|
161
|
-
saveButtonAriaLabel: PropTypes.string,
|
|
162
|
-
/**
|
|
163
|
-
* Aria-label for cancel button in editMode
|
|
164
|
-
*/
|
|
165
|
-
cancelButtonAriaLabel: PropTypes.string,
|
|
166
|
-
/**
|
|
167
|
-
* Start in editMode
|
|
168
|
-
*/
|
|
169
|
-
startWithEditOpen: PropTypes.bool,
|
|
170
|
-
/**
|
|
171
|
-
* Props that will be applied directly to the EuiEmptyButton displayed in readMode
|
|
172
|
-
*/
|
|
173
|
-
readModeProps: PropTypes.any,
|
|
174
|
-
/**
|
|
175
|
-
* Props that will be applied directly to the EuiFieldText displayed in editMode
|
|
176
|
-
*/
|
|
177
|
-
editModeProps: PropTypes.any,
|
|
178
|
-
/**
|
|
179
|
-
* Form sizes
|
|
180
|
-
*/
|
|
181
|
-
sizes: PropTypes.shape({
|
|
182
|
-
compressed: PropTypes.bool.isRequired,
|
|
183
|
-
buttonSize: PropTypes.oneOf(["xs", "s", "m"]).isRequired,
|
|
184
|
-
iconSize: PropTypes.oneOf(["s", "m"]).isRequired
|
|
185
|
-
}).isRequired,
|
|
186
|
-
/**
|
|
187
|
-
* Render prop that returns the read mode value as an arg
|
|
188
|
-
*/
|
|
189
|
-
children: PropTypes.func.isRequired
|
|
190
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "size", "defaultValue", "onConfirm", "inputAriaLabel", "saveButtonAriaLabel", "cancelButtonAriaLabel", "startWithEditOpen", "readModeProps", "editModeProps"];
|
|
2
|
-
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
/*
|
|
6
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
-
* Side Public License, v 1.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import PropTypes from "prop-types";
|
|
15
|
-
import classNames from 'classnames';
|
|
16
|
-
import { EuiText } from '../text';
|
|
17
|
-
import { EuiInlineEditForm, SMALL_SIZE_FORM, MEDIUM_SIZE_FORM } from './inline_edit_form';
|
|
18
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
-
export var EuiInlineEditText = function EuiInlineEditText(_ref) {
|
|
20
|
-
var children = _ref.children,
|
|
21
|
-
className = _ref.className,
|
|
22
|
-
_ref$size = _ref.size,
|
|
23
|
-
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
24
|
-
defaultValue = _ref.defaultValue,
|
|
25
|
-
onConfirm = _ref.onConfirm,
|
|
26
|
-
inputAriaLabel = _ref.inputAriaLabel,
|
|
27
|
-
saveButtonAriaLabel = _ref.saveButtonAriaLabel,
|
|
28
|
-
cancelButtonAriaLabel = _ref.cancelButtonAriaLabel,
|
|
29
|
-
startWithEditOpen = _ref.startWithEditOpen,
|
|
30
|
-
readModeProps = _ref.readModeProps,
|
|
31
|
-
editModeProps = _ref.editModeProps,
|
|
32
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
-
var classes = classNames('euiInlineEditText', className);
|
|
34
|
-
var isSmallSize = ['xs', 's'].includes(size);
|
|
35
|
-
var sizes = isSmallSize ? SMALL_SIZE_FORM : MEDIUM_SIZE_FORM;
|
|
36
|
-
var formProps = {
|
|
37
|
-
sizes: sizes,
|
|
38
|
-
defaultValue: defaultValue,
|
|
39
|
-
onConfirm: onConfirm,
|
|
40
|
-
inputAriaLabel: inputAriaLabel,
|
|
41
|
-
saveButtonAriaLabel: saveButtonAriaLabel,
|
|
42
|
-
cancelButtonAriaLabel: cancelButtonAriaLabel,
|
|
43
|
-
startWithEditOpen: startWithEditOpen,
|
|
44
|
-
readModeProps: readModeProps,
|
|
45
|
-
editModeProps: editModeProps
|
|
46
|
-
};
|
|
47
|
-
return ___EmotionJSX(EuiInlineEditForm, _extends({
|
|
48
|
-
className: classes
|
|
49
|
-
}, rest, formProps), function (textReadModeValue) {
|
|
50
|
-
return ___EmotionJSX(EuiText, {
|
|
51
|
-
size: size
|
|
52
|
-
}, textReadModeValue);
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
EuiInlineEditText.propTypes = {
|
|
56
|
-
className: PropTypes.string,
|
|
57
|
-
"aria-label": PropTypes.string,
|
|
58
|
-
"data-test-subj": PropTypes.string,
|
|
59
|
-
css: PropTypes.any,
|
|
60
|
-
defaultValue: PropTypes.string.isRequired,
|
|
61
|
-
/**
|
|
62
|
-
* Allow users to pass in a function that is called when the confirm button is clicked
|
|
63
|
-
* The function should return a boolean flag that will determine if the value will be saved.
|
|
64
|
-
* When the flag is true, the value will be saved. When the flag is false, the user will be
|
|
65
|
-
* returned to editMode.
|
|
66
|
-
*/
|
|
67
|
-
onConfirm: PropTypes.func,
|
|
68
|
-
/**
|
|
69
|
-
* Form label that appears above the form control
|
|
70
|
-
* This is required for accessibility because there is no visual label on the input
|
|
71
|
-
*/
|
|
72
|
-
inputAriaLabel: PropTypes.string.isRequired,
|
|
73
|
-
/**
|
|
74
|
-
* Aria-label for save button in editMode
|
|
75
|
-
*/
|
|
76
|
-
saveButtonAriaLabel: PropTypes.string,
|
|
77
|
-
/**
|
|
78
|
-
* Aria-label for cancel button in editMode
|
|
79
|
-
*/
|
|
80
|
-
cancelButtonAriaLabel: PropTypes.string,
|
|
81
|
-
/**
|
|
82
|
-
* Start in editMode
|
|
83
|
-
*/
|
|
84
|
-
startWithEditOpen: PropTypes.bool,
|
|
85
|
-
/**
|
|
86
|
-
* Props that will be applied directly to the EuiEmptyButton displayed in readMode
|
|
87
|
-
*/
|
|
88
|
-
readModeProps: PropTypes.any,
|
|
89
|
-
/**
|
|
90
|
-
* Props that will be applied directly to the EuiFieldText displayed in editMode
|
|
91
|
-
*/
|
|
92
|
-
editModeProps: PropTypes.any,
|
|
93
|
-
/**
|
|
94
|
-
* Text size level
|
|
95
|
-
*/
|
|
96
|
-
size: PropTypes.any
|
|
97
|
-
};
|