kibana/packages/kbn-securitysolution-autocomplete
Cee Chen 04d6c1d3d7
Upgrade EUI to v95.1.0 (#186324)
`v95.0.0-backport.0`  `v95.1.0-backport.0`

This PR primarily concerns converting multiple common/building block
form control components to Emotion (text, number, and search fields).
This means that custom CSS or direct `className` usage of these form
controls **should be manually QA'd** to ensure they still look the same
before visually, with no regressions.

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.1.0`](https://github.com/elastic/eui/releases/v95.1.0)

- Updated `EuiFormControlLayout` to automatically pass icon padding
affordance down to child `input`s
([#7799](https://github.com/elastic/eui/pull/7799))

**Bug fixes**

- Fixed broken focus/invalid styling on compressed `EuiDatePickerRange`s
([#7770](https://github.com/elastic/eui/pull/7770))

**CSS-in-JS conversions**

- Converted `EuiFieldText` to Emotion
([#7770](https://github.com/elastic/eui/pull/7770))
- Updated the autofill colors of Chrome (and other webkit browsers) to
better match EUI's light and dark mode
([#7776](https://github.com/elastic/eui/pull/7776))
- Converted `EuiFieldNumber` to Emotion
([#7802](https://github.com/elastic/eui/pull/7802))
- Converted `EuiFieldSearch` to Emotion
([#7802](https://github.com/elastic/eui/pull/7802))
- Converted `EuiFieldPassword` to Emotion
([#7802](https://github.com/elastic/eui/pull/7802))
- Converted `EuiTextArea` to Emotion
([#7812](https://github.com/elastic/eui/pull/7812))
- Converted `EuiSelect` to Emotion
([#7812](https://github.com/elastic/eui/pull/7812))
- Converted `EuiSuperSelect` to Emotion
([#7812](https://github.com/elastic/eui/pull/7812))

##
[`v95.1.0-backport.0`](https://github.com/elastic/eui/releases/v95.1.0-backport.0)

**This is a backport release only intended for use by Kibana.**

- Updated `EuiSteps` to support a new `titleSize="xxs"` style, which
outputs the same title font size but smaller unnumbered step indicators
([#7813](https://github.com/elastic/eui/pull/7813))
- Updated `EuiStepsHorizontal` to support a new `size="xs"` style, which
outputs smaller unnumbered step indicators
([#7813](https://github.com/elastic/eui/pull/7813))
- Updated `EuiStepNumber` to support new `titleSize="none"` which omits
rendering step numbers, and will only render icons
([#7813](https://github.com/elastic/eui/pull/7813))
2024-06-21 09:10:58 -07:00
..
src Upgrade EUI to v95.1.0 (#186324) 2024-06-21 09:10:58 -07:00
index.ts Fixing leading or trailing whitespace in exception entries (#139617) 2022-08-31 16:14:56 +02:00
jest.config.js
kibana.jsonc [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
package.json flag packages without side effects (#173351) 2023-12-19 02:46:39 -07: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'
/>