kibana/packages/kbn-securitysolution-autocomplete
Jason Stoltzfus c339ca8394
Upgraded EUI to v76.0.0 (#152506)
👋 Hi all - the biggest breaking change of this PR is around two icon
type changes/renames.

1. ⚠️ **The  `alert` icon is now named `warning`**
- <img width="103" alt=""
src="https://user-images.githubusercontent.com/549407/223561599-8913e88c-676f-47cd-aaed-81b64783bd81.png"
align="middle">
- This change should have been automatically converted on your behalf by
the EUI team, **but if for some reason** we missed making this
conversion in this PR and your icon(s) are now broken, please ping us or
let us know in this PR (or fix yourself after this PR merges).
- In some cases, teams were using this icon for error messages,
alongside the `danger` color. In those cases, we opinionatedly changed
those icon usages to the new `error` icon instead of using the old
alert/warning icon.

2. 🛑 **The `crossInACircleFilled` icon has been removed, and a new
`error` icon added**
- <img width="84" alt=""
src="https://user-images.githubusercontent.com/549407/223561892-4406bdf6-1a55-49ac-85ad-3a11eb7c090d.png"
align="middle">
- The conversion for this breaking change was not straightforward. This
was the path we used to determine what to change `crossInACircleFilled`
usages to:
- If the icon was associated with errors or error messages, we changed
it to the new `error` icon.
- If a "delete" action was associated with this icon, we changed it to
the `trash` icon instead.
- If a "clear" action was associated with this icon, we changed it to
just the `cross` icon, or in some cases `minusInCircleFilled` (if used
alongside `plusInCircleFilled`).
- Again, if we made a mistake during this conversion or missed your
plugin, please feel free to ping us.

## Summary

`eui@75.1.2`  `eui@76.0.2`

## [`76.0.2`](https://github.com/elastic/eui/tree/v76.0.2)

**Bug fixes**

- Added a legacy `alert` alias for the `warning` `EuiIcon` type
([#6640](https://github.com/elastic/eui/pull/6640))

## [`76.0.1`](https://github.com/elastic/eui/tree/v76.0.1)

**Bug fixes**

- Fixed broken icons on all `isInvalid` form controls
([#6629](https://github.com/elastic/eui/pull/6629))

## [`76.0.0`](https://github.com/elastic/eui/tree/v76.0.0)

- Added `pivot` glyph to `EuiIcon`
([#6605](https://github.com/elastic/eui/pull/6605))
- Added the `displayHeaderCellProps` API to `EuiDataGrid`'s columns,
which allows passing custom props directly to column header cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added the new `headerCellProps`/`footerCellProps` APIs to
`EuiDataGrid`'s control columns, which allows passing custom props
directly to control column header or footer cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added a new `footerCellRender` API to `EuiDataGrid`'s control columns,
which allows completely customizing control column rendering (previously
rendered an empty cell)
([#6609](https://github.com/elastic/eui/pull/6609))
- Updated the styling of nested ordered lists in `EuiText` to align with
GitHub's list style, which is a popular format used in Markdown or MDX
formatting ([#6615](https://github.com/elastic/eui/pull/6615))
- Added a margin-bottom property exclusively to the direct child `ul`
and `ol` elements of the `EuiText` component
([#6615](https://github.com/elastic/eui/pull/6615))
- Fix issue with badges appearing within an `EuiBadgeGroup`, where the
CSS rule to override the `margin-inline-start` was not being applied
correctly due to the order of appearance in the CSS rules
([#6618](https://github.com/elastic/eui/pull/6618))

**Bug fixes**

- Fixed `EuiDataGrid` footer control columns rendering with cell
expansion popovers when they should not have been
([#6609](https://github.com/elastic/eui/pull/6609))
- Fixed an `EuiSkipLink` bug where main content loading in
progressively/dynamically after the skip link rendered was not being
correctly focused ([#6613](https://github.com/elastic/eui/pull/6613))

**Breaking changes**

- Renamed `EuiIcon`'s `alert` to `warning`
([#6608](https://github.com/elastic/eui/pull/6608))
- Removed `EuiIcon`'s `crossInACircleFilled` in favor of `error`
([#6608](https://github.com/elastic/eui/pull/6608))

---------

Co-authored-by: Davey Holler <daveyholler@hey.com>
Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jon <jon@elastic.co>
2023-03-14 14:27:40 -05:00
..
src Upgraded EUI to v76.0.0 (#152506) 2023-03-14 14:27:40 -05:00
index.ts Fixing leading or trailing whitespace in exception entries (#139617) 2022-08-31 16:14:56 +02:00
jest.config.js [Security Solutions][Detection Engine] Creates an autocomplete package and moves duplicate code between lists and security_solution there (#105382) 2021-07-22 12:44:54 -06:00
kibana.jsonc Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.md [Security Solution][Endpoint] Adds matches wildcard operator for file.path.text field for Event Filters (#125202) 2022-03-02 11:55:58 -07:00
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

Autocomplete Fields

Need an input that shows available index fields? Or an input that auto-completes based on a selected indexPattern field? Bingo! That's what these components are for. They are generalized enough so that they can be reused throughout and repurposed based on your needs.

All three of the available components rely on Eui's combo box.

useFieldValueAutocomplete

This hook uses the kibana services.data.autocomplete.getValueSuggestions() service to return possible autocomplete fields based on the passed in indexPattern and selectedField.

FieldComponent

This component can be used to display available indexPattern fields. It requires an indexPattern to be passed in and will show an error state if value is not one of the available indexPattern fields. Users will be able to select only one option.

The onChange handler is passed DataViewFieldBase[].

<FieldComponent
  placeholder={i18n.FIELD_PLACEHOLDER}
  indexPattern={indexPattern}
  selectedField={selectedField}
  isLoading={isLoading}
  isClearable={isClearable}
  onChange={handleFieldChange}
/>

OperatorComponent

This component can be used to display available operators. If you want to pass in your own operators, you can use operatorOptions prop. If a operatorOptions is provided, those will be used and it will ignore any of the built in logic that determines which operators to show. The operators within operatorOptions will still need to be of type OperatorOption.

If no operatorOptions is provided, then the following behavior is observed:

  • if selectedField type is boolean, only is, is not, exists, does not exist operators will show
  • if selectedField type is nested, only is operator will show
  • if not one of the above, all operators will show (see operators.ts)

The onChange handler is passed OperatorOption[].

<OperatorComponent
  placeholder={i18n.OPERATOR_PLACEHOLDER}
  selectedField={selectedField}
  operator={selectedOperator}
  isDisabled={iDisabled}
  isLoading={isLoading}
  isClearable={isClearable}
  onChange={handleOperatorChange}
/>

AutocompleteFieldExistsComponent

This field value component is used when the selected operator is exists or does not exist. When these operators are selected, they are equivalent to using a wildcard. The combo box will be displayed as disabled.

<AutocompleteFieldExistsComponent placeholder={i18n.EXISTS_VALUE_PLACEHOLDER} />

AutocompleteFieldListsComponent

This component can be used to display available large value lists - when operator selected is is in list or is not in list. It relies on hooks from the lists plugin. Users can only select one list and an error is shown if value is not one of available lists.

The selectedValue should be the id of the selected list.

This component relies on selectedField to render available lists. The reason being that it relies on the selectedField type to determine which lists to show as each large value list has a type as well. So if a user selects a field of type ip, it will only display lists of type ip.

The onChange handler is passed ListSchema.

<AutocompleteFieldListsComponent
  selectedField={selectedField}
  placeholder={i18n.FIELD_LISTS_PLACEHOLDER}
  selectedValue={id}
  isLoading={isLoading}
  isDisabled={iDisabled}
  isClearable={isClearable}
  onChange={handleFieldListValueChange}
/>

AutocompleteFieldMatchComponent

This component can be used to allow users to select one single value. It uses the autocomplete hook to display any autocomplete options based on the passed in indexPattern, but also allows a user to add their own value.

It does some minor validation, assuring that field value is a date if selectedField type is date, a number if selectedField type is number, an ip if selectedField type is ip.

The onChange handler is passed selected string.

<AutocompleteFieldMatchComponent
  placeholder={i18n.FIELD_VALUE_PLACEHOLDER}
  selectedField={selectedField}
  selectedValue={value}
  isDisabled={iDisabled}
  isLoading={isLoading}
  isClearable={isClearable}
  indexPattern={indexPattern}
  onChange={handleFieldMatchValueChange}
/>

AutocompleteFieldMatchAnyComponent

This component can be used to allow users to select multiple values. It uses the autocomplete hook to display any autocomplete options based on the passed in indexPattern, but also allows a user to add their own values.

It does some minor validation, assuring that field values are a date if selectedField type is date, numbers if selectedField type is number, ips if selectedField type is ip.

The onChange handler is passed selected string[].

<AutocompleteFieldMatchAnyComponent
  placeholder={i18n.FIELD_VALUE_PLACEHOLDER}
  selectedField={selectedField}
  selectedValue={values}
  isDisabled={false}
  isLoading={isLoading}
  isClearable={false}
  indexPattern={indexPattern}
  onChange={handleFieldMatchAnyValueChange}
/>

AutocompleteFieldWildcardComponent

This component can be used to allow users to select a single value. It uses the autocomplete hook to display any autocomplete options based on the passed in indexPattern, but also allows a user to add their own value.

The onChange handler is passed selected string[].

<AutocompleteFieldWildcardComponent
  placeholder={i18n.FIELD_VALUE_PLACEHOLDER}
  selectedField={selectedField}
  selectedValue={values}
  isDisabled={false}
  isLoading={isLoading}
  isClearable={false}
  indexPattern={indexPattern}
  onChange={handleFieldMatchAnyValueChange}
  warning='input warning'
/>