-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chore/upgrade-markdown-it
- Loading branch information
Showing
1,273 changed files
with
6,587 additions
and
2,832 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/plugins/es_ui_shared/static/forms/components/fields/radio_group_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFormRow, EuiRadioGroup } from '@elastic/eui'; | ||
|
||
import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; | ||
|
||
interface Props { | ||
field: FieldHook; | ||
euiFieldProps?: Record<string, any>; | ||
idAria?: string; | ||
[key: string]: any; | ||
} | ||
|
||
export const RadioGroupField = ({ field, euiFieldProps = {}, ...rest }: Props) => { | ||
const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); | ||
|
||
return ( | ||
<EuiFormRow | ||
label={field.label} | ||
helpText={field.helpText} | ||
error={errorMessage} | ||
isInvalid={isInvalid} | ||
fullWidth | ||
data-test-subj={rest['data-test-subj']} | ||
describedByIds={rest.idAria ? [rest.idAria] : undefined} | ||
> | ||
<EuiRadioGroup | ||
idSelected={field.value as string} | ||
options={[]} | ||
onChange={field.setValue} | ||
data-test-subj="input" | ||
{...euiFieldProps} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}; |
68 changes: 68 additions & 0 deletions
68
src/plugins/es_ui_shared/static/forms/components/fields/range_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React, { useCallback } from 'react'; | ||
import { EuiFormRow, EuiRange } from '@elastic/eui'; | ||
|
||
import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; | ||
|
||
interface Props { | ||
field: FieldHook; | ||
euiFieldProps?: Record<string, any>; | ||
idAria?: string; | ||
[key: string]: any; | ||
} | ||
|
||
export const RangeField = ({ field, euiFieldProps = {}, ...rest }: Props) => { | ||
const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); | ||
|
||
const onChange = useCallback( | ||
(e: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) => { | ||
const event = ({ ...e, value: `${e.currentTarget.value}` } as unknown) as React.ChangeEvent<{ | ||
value: string; | ||
}>; | ||
field.onChange(event); | ||
}, | ||
[field.onChange] | ||
); | ||
|
||
return ( | ||
<EuiFormRow | ||
label={field.label} | ||
helpText={field.helpText} | ||
error={errorMessage} | ||
isInvalid={isInvalid} | ||
fullWidth | ||
data-test-subj={rest['data-test-subj']} | ||
describedByIds={rest.idAria ? [rest.idAria] : undefined} | ||
> | ||
<EuiRange | ||
value={field.value as number} | ||
onChange={onChange} | ||
max={10} | ||
min={0} | ||
showRange | ||
showInput | ||
fullWidth | ||
data-test-subj="range" | ||
{...euiFieldProps} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.