@elastic/eui 77.0.0 → 77.1.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.
- package/dist/eui_theme_dark.css +22 -51
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +22 -51
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.a11y.js +3 -1
- package/es/components/accordion/accordion.js +4 -2
- package/es/components/basic_table/table.a11y.js +3 -1
- package/es/components/breadcrumbs/breadcrumbs.a11y.js +3 -1
- package/es/components/card/card.a11y.js +3 -1
- package/es/components/color_picker/color_picker.a11y.js +3 -1
- package/es/components/combo_box/combo_box.a11y.js +3 -1
- package/es/components/combo_box/combo_box.js +2 -21
- package/es/components/combo_box/combo_box_input/combo_box_input.js +66 -36
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +1 -1
- package/es/components/context_menu/context_menu_panel.a11y.js +3 -1
- package/es/components/control_bar/control_bar.a11y.js +3 -1
- package/es/components/copy/copy.a11y.js +6 -5
- package/es/components/datagrid/data_grid.a11y.js +3 -1
- package/es/components/date_picker/date_picker.a11y.js +3 -1
- package/es/components/date_picker/date_picker.js +148 -155
- package/es/components/date_picker/date_picker_range.js +2 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +3 -1
- package/es/components/delay_hide/delay_hide.a11y.js +9 -9
- package/es/components/delay_render/delay_render.a11y.js +9 -9
- package/es/components/drag_and_drop/drag_and_drop.a11y.js +3 -2
- package/es/components/empty_prompt/empty_prompt.a11y.js +8 -14
- package/es/components/error_boundary/error_boundary.a11y.js +3 -1
- package/es/components/expression/expression.a11y.js +3 -1
- package/es/components/filter_group/filter_group.a11y.js +4 -3
- package/es/components/flyout/flyout.a11y.js +3 -1
- package/es/components/focus_trap/focus_trap.a11y.js +3 -1
- package/es/components/form/checkbox/checkbox_group.a11y.js +3 -1
- package/es/components/form/file_picker/file_picker.js +4 -2
- package/es/components/form/radio/radio_group.a11y.js +4 -5
- package/es/components/form/range/range.a11y.js +3 -1
- package/es/components/form/switch/switch.a11y.js +4 -5
- package/es/components/form/text_area/text_area.js +11 -3
- package/es/components/form/validatable_control/index.js +1 -1
- package/es/components/form/validatable_control/validatable_control.js +49 -13
- package/es/components/header/header.a11y.js +3 -1
- package/es/components/icon/icon_ML.a11y.js +3 -1
- package/es/components/icon/icon_apps.a11y.js +3 -1
- package/es/components/icon/icon_editor.a11y.js +3 -1
- package/es/components/icon/icon_elastic.a11y.js +3 -1
- package/es/components/icon/icon_glyphs.a11y.js +3 -1
- package/es/components/icon/icon_tokens.a11y.js +3 -1
- package/es/components/image/image.a11y.js +3 -1
- package/es/components/index.js +1 -0
- package/es/components/inline_edit/index.js +10 -0
- package/es/components/inline_edit/inline_edit.styles.js +15 -0
- package/es/components/inline_edit/inline_edit_form.js +190 -0
- package/es/components/inline_edit/inline_edit_text.js +97 -0
- package/es/components/inline_edit/inline_edit_title.js +105 -0
- package/es/components/key_pad_menu/key_pad_menu.a11y.js +3 -1
- package/es/components/modal/modal.a11y.js +3 -1
- package/es/components/notification/notification_event.a11y.js +3 -1
- package/es/components/page/page_header/page_header.a11y.js +3 -1
- package/es/components/pagination/pagination.a11y.js +3 -1
- package/es/components/popover/popover.a11y.js +3 -1
- package/es/components/popover/popover_footer.js +4 -4
- package/es/components/popover/popover_footer.styles.js +16 -5
- package/es/components/popover/popover_panel/_popover_panel.js +8 -5
- package/es/components/portal/portal.a11y.js +3 -1
- package/es/components/progress/progress.a11y.js +3 -1
- package/es/components/resizable_container/resizable_container.a11y.js +3 -1
- package/es/components/search_bar/search_bar.a11y.js +8 -7
- package/es/components/selectable/selectable.a11y.js +3 -1
- package/es/components/side_nav/side_nav.a11y.js +3 -1
- package/es/components/tabs/tabs.a11y.js +3 -1
- package/es/components/tree_view/tree_view.a11y.js +3 -1
- package/eui.d.ts +161 -37
- package/i18ntokens.json +40 -4
- package/lib/components/accordion/accordion.a11y.js +3 -1
- package/lib/components/accordion/accordion.js +4 -2
- package/lib/components/basic_table/table.a11y.js +3 -1
- package/lib/components/breadcrumbs/breadcrumbs.a11y.js +3 -1
- package/lib/components/combo_box/combo_box.js +2 -21
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +66 -36
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +1 -1
- package/lib/components/context_menu/context_menu_panel.a11y.js +3 -1
- package/lib/components/copy/copy.a11y.js +3 -4
- package/lib/components/date_picker/date_picker.js +147 -153
- package/lib/components/date_picker/date_picker_range.js +2 -2
- package/lib/components/delay_hide/delay_hide.a11y.js +6 -8
- package/lib/components/delay_render/delay_render.a11y.js +6 -8
- package/lib/components/drag_and_drop/drag_and_drop.a11y.js +0 -1
- package/lib/components/empty_prompt/empty_prompt.a11y.js +8 -14
- package/lib/components/error_boundary/error_boundary.a11y.js +3 -1
- package/lib/components/filter_group/filter_group.a11y.js +7 -8
- package/lib/components/form/file_picker/file_picker.js +4 -2
- package/lib/components/form/radio/radio_group.a11y.js +1 -4
- package/lib/components/form/switch/switch.a11y.js +1 -4
- package/lib/components/form/text_area/text_area.js +11 -3
- package/lib/components/form/validatable_control/index.js +6 -0
- package/lib/components/form/validatable_control/validatable_control.js +51 -14
- package/lib/components/icon/icon_ML.a11y.js +3 -1
- package/lib/components/icon/icon_apps.a11y.js +3 -1
- package/lib/components/icon/icon_editor.a11y.js +3 -1
- package/lib/components/icon/icon_elastic.a11y.js +3 -1
- package/lib/components/icon/icon_glyphs.a11y.js +3 -1
- package/lib/components/icon/icon_tokens.a11y.js +3 -1
- package/lib/components/image/image.a11y.js +3 -1
- package/lib/components/index.js +11 -0
- package/lib/components/inline_edit/index.js +19 -0
- package/lib/components/inline_edit/inline_edit.styles.js +22 -0
- package/lib/components/inline_edit/inline_edit_form.js +193 -0
- package/lib/components/inline_edit/inline_edit_text.js +97 -0
- package/lib/components/inline_edit/inline_edit_title.js +106 -0
- package/lib/components/page/page_header/page_header.a11y.js +3 -1
- package/lib/components/popover/popover_footer.js +4 -4
- package/lib/components/popover/popover_footer.styles.js +19 -7
- package/lib/components/popover/popover_panel/_popover_panel.js +7 -4
- package/lib/components/resizable_container/resizable_container.a11y.js +3 -1
- package/lib/components/search_bar/search_bar.a11y.js +5 -6
- package/lib/components/tree_view/tree_view.a11y.js +3 -1
- package/optimize/es/components/accordion/accordion.a11y.js +3 -1
- package/optimize/es/components/accordion/accordion.js +4 -2
- package/optimize/es/components/basic_table/table.a11y.js +3 -1
- package/optimize/es/components/breadcrumbs/breadcrumbs.a11y.js +3 -1
- package/optimize/es/components/card/card.a11y.js +3 -1
- package/optimize/es/components/color_picker/color_picker.a11y.js +3 -1
- package/optimize/es/components/combo_box/combo_box.a11y.js +3 -1
- package/optimize/es/components/combo_box/combo_box.js +2 -21
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +63 -34
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +1 -1
- package/optimize/es/components/context_menu/context_menu_panel.a11y.js +3 -1
- package/optimize/es/components/control_bar/control_bar.a11y.js +3 -1
- package/optimize/es/components/copy/copy.a11y.js +6 -5
- package/optimize/es/components/datagrid/data_grid.a11y.js +3 -1
- package/optimize/es/components/date_picker/date_picker.a11y.js +3 -1
- package/optimize/es/components/date_picker/date_picker.js +142 -148
- package/optimize/es/components/date_picker/date_picker_range.js +1 -1
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +3 -1
- package/optimize/es/components/delay_hide/delay_hide.a11y.js +9 -9
- package/optimize/es/components/delay_render/delay_render.a11y.js +9 -9
- package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +3 -2
- package/optimize/es/components/empty_prompt/empty_prompt.a11y.js +8 -14
- package/optimize/es/components/error_boundary/error_boundary.a11y.js +3 -1
- package/optimize/es/components/expression/expression.a11y.js +3 -1
- package/optimize/es/components/filter_group/filter_group.a11y.js +4 -3
- package/optimize/es/components/flyout/flyout.a11y.js +3 -1
- package/optimize/es/components/focus_trap/focus_trap.a11y.js +3 -1
- package/optimize/es/components/form/checkbox/checkbox_group.a11y.js +3 -1
- package/optimize/es/components/form/file_picker/file_picker.js +4 -2
- package/optimize/es/components/form/radio/radio_group.a11y.js +4 -5
- package/optimize/es/components/form/range/range.a11y.js +3 -1
- package/optimize/es/components/form/switch/switch.a11y.js +4 -5
- package/optimize/es/components/form/text_area/text_area.js +10 -3
- package/optimize/es/components/form/validatable_control/index.js +1 -1
- package/optimize/es/components/form/validatable_control/validatable_control.js +49 -9
- package/optimize/es/components/header/header.a11y.js +3 -1
- package/optimize/es/components/icon/icon_ML.a11y.js +3 -1
- package/optimize/es/components/icon/icon_apps.a11y.js +3 -1
- package/optimize/es/components/icon/icon_editor.a11y.js +3 -1
- package/optimize/es/components/icon/icon_elastic.a11y.js +3 -1
- package/optimize/es/components/icon/icon_glyphs.a11y.js +3 -1
- package/optimize/es/components/icon/icon_tokens.a11y.js +3 -1
- package/optimize/es/components/image/image.a11y.js +3 -1
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/inline_edit/index.js +10 -0
- package/optimize/es/components/inline_edit/inline_edit.styles.js +15 -0
- package/optimize/es/components/inline_edit/inline_edit_form.js +133 -0
- package/optimize/es/components/inline_edit/inline_edit_text.js +52 -0
- package/optimize/es/components/inline_edit/inline_edit_title.js +56 -0
- package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +3 -1
- package/optimize/es/components/modal/modal.a11y.js +3 -1
- package/optimize/es/components/notification/notification_event.a11y.js +3 -1
- package/optimize/es/components/page/page_header/page_header.a11y.js +3 -1
- package/optimize/es/components/pagination/pagination.a11y.js +3 -1
- package/optimize/es/components/popover/popover.a11y.js +3 -1
- package/optimize/es/components/popover/popover_footer.js +4 -4
- package/optimize/es/components/popover/popover_footer.styles.js +16 -5
- package/optimize/es/components/popover/popover_panel/_popover_panel.js +8 -5
- package/optimize/es/components/portal/portal.a11y.js +3 -1
- package/optimize/es/components/progress/progress.a11y.js +3 -1
- package/optimize/es/components/resizable_container/resizable_container.a11y.js +3 -1
- package/optimize/es/components/search_bar/search_bar.a11y.js +8 -7
- package/optimize/es/components/selectable/selectable.a11y.js +3 -1
- package/optimize/es/components/side_nav/side_nav.a11y.js +3 -1
- package/optimize/es/components/tabs/tabs.a11y.js +3 -1
- package/optimize/es/components/tree_view/tree_view.a11y.js +3 -1
- package/optimize/lib/components/accordion/accordion.a11y.js +3 -1
- package/optimize/lib/components/accordion/accordion.js +4 -2
- package/optimize/lib/components/basic_table/table.a11y.js +3 -1
- package/optimize/lib/components/breadcrumbs/breadcrumbs.a11y.js +3 -1
- package/optimize/lib/components/card/card.a11y.js +3 -1
- package/optimize/lib/components/color_picker/color_picker.a11y.js +3 -1
- package/optimize/lib/components/combo_box/combo_box.a11y.js +3 -1
- package/optimize/lib/components/combo_box/combo_box.js +2 -21
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +63 -34
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +1 -1
- package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +3 -1
- package/optimize/lib/components/control_bar/control_bar.a11y.js +3 -1
- package/optimize/lib/components/copy/copy.a11y.js +6 -5
- package/optimize/lib/components/datagrid/data_grid.a11y.js +3 -1
- package/optimize/lib/components/date_picker/date_picker.a11y.js +3 -1
- package/optimize/lib/components/date_picker/date_picker.js +141 -147
- package/optimize/lib/components/date_picker/date_picker_range.js +1 -1
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +3 -1
- package/optimize/lib/components/delay_hide/delay_hide.a11y.js +9 -9
- package/optimize/lib/components/delay_render/delay_render.a11y.js +9 -9
- package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +3 -2
- package/optimize/lib/components/empty_prompt/empty_prompt.a11y.js +8 -14
- package/optimize/lib/components/error_boundary/error_boundary.a11y.js +3 -1
- package/optimize/lib/components/filter_group/filter_group.a11y.js +10 -9
- package/optimize/lib/components/focus_trap/focus_trap.a11y.js +3 -1
- package/optimize/lib/components/form/file_picker/file_picker.js +4 -2
- package/optimize/lib/components/form/radio/radio_group.a11y.js +4 -5
- package/optimize/lib/components/form/range/range.a11y.js +3 -1
- package/optimize/lib/components/form/switch/switch.a11y.js +4 -5
- package/optimize/lib/components/form/text_area/text_area.js +10 -3
- package/optimize/lib/components/form/validatable_control/index.js +6 -0
- package/optimize/lib/components/form/validatable_control/validatable_control.js +52 -12
- package/optimize/lib/components/header/header.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_ML.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_apps.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_editor.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_elastic.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_glyphs.a11y.js +3 -1
- package/optimize/lib/components/icon/icon_tokens.a11y.js +3 -1
- package/optimize/lib/components/image/image.a11y.js +3 -1
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/inline_edit/index.js +19 -0
- package/optimize/lib/components/inline_edit/inline_edit.styles.js +22 -0
- package/optimize/lib/components/inline_edit/inline_edit_form.js +144 -0
- package/optimize/lib/components/inline_edit/inline_edit_text.js +52 -0
- package/optimize/lib/components/inline_edit/inline_edit_title.js +57 -0
- package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +3 -1
- package/optimize/lib/components/modal/modal.a11y.js +3 -1
- package/optimize/lib/components/notification/notification_event.a11y.js +3 -1
- package/optimize/lib/components/page/page_header/page_header.a11y.js +3 -1
- package/optimize/lib/components/pagination/pagination.a11y.js +3 -1
- package/optimize/lib/components/popover/popover.a11y.js +3 -1
- package/optimize/lib/components/popover/popover_footer.js +4 -4
- package/optimize/lib/components/popover/popover_footer.styles.js +19 -7
- package/optimize/lib/components/popover/popover_panel/_popover_panel.js +7 -4
- package/optimize/lib/components/portal/portal.a11y.js +3 -1
- package/optimize/lib/components/progress/progress.a11y.js +3 -1
- package/optimize/lib/components/resizable_container/resizable_container.a11y.js +3 -1
- package/optimize/lib/components/search_bar/search_bar.a11y.js +8 -7
- package/optimize/lib/components/selectable/selectable.a11y.js +3 -1
- package/optimize/lib/components/side_nav/side_nav.a11y.js +3 -1
- package/optimize/lib/components/tree_view/tree_view.a11y.js +3 -1
- package/package.json +1 -1
- package/src/components/combo_box/_combo_box.scss +2 -38
- package/src/components/date_picker/_date_picker_range.scss +1 -1
- package/src/components/form/field_text/_field_text.scss +0 -7
- package/src/components/form/file_picker/_file_picker.scss +3 -2
- package/src/components/form/form_control_layout/_form_control_layout.scss +7 -2
- package/src/components/form/text_area/_text_area.scss +9 -0
- package/test-env/components/accordion/accordion.a11y.js +3 -1
- package/test-env/components/accordion/accordion.js +4 -2
- package/test-env/components/basic_table/table.a11y.js +3 -1
- package/test-env/components/breadcrumbs/breadcrumbs.a11y.js +3 -1
- package/test-env/components/card/card.a11y.js +3 -1
- package/test-env/components/color_picker/color_picker.a11y.js +3 -1
- package/test-env/components/combo_box/combo_box.a11y.js +3 -1
- package/test-env/components/combo_box/combo_box.js +2 -21
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +66 -36
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +1 -1
- package/test-env/components/context_menu/context_menu_panel.a11y.js +3 -1
- package/test-env/components/control_bar/control_bar.a11y.js +3 -1
- package/test-env/components/copy/copy.a11y.js +6 -5
- package/test-env/components/datagrid/data_grid.a11y.js +3 -1
- package/test-env/components/date_picker/date_picker.a11y.js +3 -1
- package/test-env/components/date_picker/date_picker.js +141 -147
- package/test-env/components/date_picker/date_picker_range.js +2 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.a11y.js +3 -1
- package/test-env/components/delay_hide/delay_hide.a11y.js +9 -9
- package/test-env/components/delay_render/delay_render.a11y.js +9 -9
- package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +3 -2
- package/test-env/components/empty_prompt/empty_prompt.a11y.js +8 -14
- package/test-env/components/error_boundary/error_boundary.a11y.js +3 -1
- package/test-env/components/filter_group/filter_group.a11y.js +10 -9
- package/test-env/components/focus_trap/focus_trap.a11y.js +3 -1
- package/test-env/components/form/file_picker/file_picker.js +4 -2
- package/test-env/components/form/radio/radio_group.a11y.js +4 -5
- package/test-env/components/form/range/range.a11y.js +3 -1
- package/test-env/components/form/switch/switch.a11y.js +4 -5
- package/test-env/components/form/text_area/text_area.js +11 -3
- package/test-env/components/form/validatable_control/index.js +6 -0
- package/test-env/components/form/validatable_control/validatable_control.js +51 -14
- package/test-env/components/header/header.a11y.js +3 -1
- package/test-env/components/icon/icon_ML.a11y.js +3 -1
- package/test-env/components/icon/icon_apps.a11y.js +3 -1
- package/test-env/components/icon/icon_editor.a11y.js +3 -1
- package/test-env/components/icon/icon_elastic.a11y.js +3 -1
- package/test-env/components/icon/icon_glyphs.a11y.js +3 -1
- package/test-env/components/icon/icon_tokens.a11y.js +3 -1
- package/test-env/components/image/image.a11y.js +3 -1
- package/test-env/components/index.js +11 -0
- package/test-env/components/inline_edit/index.js +19 -0
- package/test-env/components/inline_edit/inline_edit.styles.js +22 -0
- package/test-env/components/inline_edit/inline_edit_form.js +196 -0
- package/test-env/components/inline_edit/inline_edit_text.js +96 -0
- package/test-env/components/inline_edit/inline_edit_title.js +105 -0
- package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +3 -1
- package/test-env/components/modal/modal.a11y.js +3 -1
- package/test-env/components/notification/notification_event.a11y.js +3 -1
- package/test-env/components/page/page_header/page_header.a11y.js +3 -1
- package/test-env/components/pagination/pagination.a11y.js +3 -1
- package/test-env/components/popover/popover.a11y.js +3 -1
- package/test-env/components/popover/popover_footer.js +4 -4
- package/test-env/components/popover/popover_footer.styles.js +19 -7
- package/test-env/components/popover/popover_panel/_popover_panel.js +7 -4
- package/test-env/components/portal/portal.a11y.js +3 -1
- package/test-env/components/progress/progress.a11y.js +3 -1
- package/test-env/components/resizable_container/resizable_container.a11y.js +3 -1
- package/test-env/components/search_bar/search_bar.a11y.js +8 -7
- package/test-env/components/selectable/selectable.a11y.js +3 -1
- package/test-env/components/side_nav/side_nav.a11y.js +3 -1
- package/test-env/components/tree_view/tree_view.a11y.js +3 -1
|
@@ -12,7 +12,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/// <reference types="
|
|
15
|
+
/// <reference types="cypress" />
|
|
16
|
+
/// <reference types="cypress-real-events" />
|
|
17
|
+
/// <reference types="../../../../cypress/support" />
|
|
16
18
|
|
|
17
19
|
import React, { useState } from 'react';
|
|
18
20
|
import { EuiDualRange } from './dual_range';
|
|
@@ -12,7 +12,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/// <reference types="
|
|
15
|
+
/// <reference types="cypress" />
|
|
16
|
+
/// <reference types="cypress-real-events" />
|
|
17
|
+
/// <reference types="../../../../cypress/support" />
|
|
16
18
|
|
|
17
19
|
import React, { useState } from 'react';
|
|
18
20
|
import { EuiSwitch } from './switch';
|
|
@@ -22,14 +24,11 @@ var Switch = function Switch() {
|
|
|
22
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
25
|
checked = _useState2[0],
|
|
24
26
|
setChecked = _useState2[1];
|
|
25
|
-
var _onChange = function onChange(e) {
|
|
26
|
-
setChecked(e.target.checked);
|
|
27
|
-
};
|
|
28
27
|
return ___EmotionJSX(EuiSwitch, {
|
|
29
28
|
label: "Malware protection",
|
|
30
29
|
checked: checked,
|
|
31
30
|
onChange: function onChange(e) {
|
|
32
|
-
return
|
|
31
|
+
return setChecked(e.target.checked);
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inputRef", "isInvalid", "name", "placeholder", "resize", "rows"];
|
|
1
|
+
var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inputRef", "isLoading", "isInvalid", "name", "placeholder", "resize", "rows"];
|
|
2
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
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
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; }
|
|
@@ -13,6 +13,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { EuiFormControlLayout } from '../form_control_layout';
|
|
16
17
|
import { EuiValidatableControl } from '../validatable_control';
|
|
17
18
|
import { useFormContext } from '../eui_form_context';
|
|
18
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -33,6 +34,7 @@ export var EuiTextArea = function EuiTextArea(props) {
|
|
|
33
34
|
fullWidth = _props$fullWidth === void 0 ? defaultFullWidth : _props$fullWidth,
|
|
34
35
|
id = props.id,
|
|
35
36
|
inputRef = props.inputRef,
|
|
37
|
+
isLoading = props.isLoading,
|
|
36
38
|
isInvalid = props.isInvalid,
|
|
37
39
|
name = props.name,
|
|
38
40
|
placeholder = props.placeholder,
|
|
@@ -52,7 +54,12 @@ export var EuiTextArea = function EuiTextArea(props) {
|
|
|
52
54
|
} else {
|
|
53
55
|
definedRows = 6;
|
|
54
56
|
}
|
|
55
|
-
return ___EmotionJSX(
|
|
57
|
+
return ___EmotionJSX(EuiFormControlLayout, {
|
|
58
|
+
fullWidth: fullWidth,
|
|
59
|
+
isLoading: isLoading,
|
|
60
|
+
isInvalid: isInvalid,
|
|
61
|
+
className: "euiFormControlLayout--euiTextArea"
|
|
62
|
+
}, ___EmotionJSX(EuiValidatableControl, {
|
|
56
63
|
isInvalid: isInvalid
|
|
57
64
|
}, ___EmotionJSX("textarea", _extends({
|
|
58
65
|
className: classes
|
|
@@ -62,13 +69,14 @@ export var EuiTextArea = function EuiTextArea(props) {
|
|
|
62
69
|
id: id,
|
|
63
70
|
ref: inputRef,
|
|
64
71
|
placeholder: placeholder
|
|
65
|
-
}), children));
|
|
72
|
+
}), children)));
|
|
66
73
|
};
|
|
67
74
|
EuiTextArea.propTypes = {
|
|
68
75
|
className: PropTypes.string,
|
|
69
76
|
"aria-label": PropTypes.string,
|
|
70
77
|
"data-test-subj": PropTypes.string,
|
|
71
78
|
css: PropTypes.any,
|
|
79
|
+
isLoading: PropTypes.bool,
|
|
72
80
|
isInvalid: PropTypes.bool,
|
|
73
81
|
/**
|
|
74
82
|
* Expand to fill 100% of the parent.
|
|
@@ -11,6 +11,12 @@ import PropTypes from "prop-types";
|
|
|
11
11
|
function isMutableRef(ref) {
|
|
12
12
|
return ref != null && ref.hasOwnProperty('current');
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `EuiValidatableControl` component should be used in scenarios where
|
|
17
|
+
* we can render the validated `<input>` as its direct child.
|
|
18
|
+
*/
|
|
19
|
+
|
|
14
20
|
export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
15
21
|
var isInvalid = _ref.isInvalid,
|
|
16
22
|
children = _ref.children;
|
|
@@ -27,32 +33,62 @@ export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
|
27
33
|
childRef.current = element;
|
|
28
34
|
}
|
|
29
35
|
}, [childRef]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (isInvalid) {
|
|
36
|
-
control.current.setCustomValidity('Invalid');
|
|
37
|
-
} else {
|
|
38
|
-
control.current.setCustomValidity('');
|
|
39
|
-
}
|
|
36
|
+
useSetControlValidity({
|
|
37
|
+
controlEl: control.current,
|
|
38
|
+
isInvalid: isInvalid
|
|
40
39
|
});
|
|
41
40
|
return /*#__PURE__*/cloneElement(child, {
|
|
42
41
|
ref: replacedRef,
|
|
43
42
|
'aria-invalid': isInvalid
|
|
44
43
|
});
|
|
45
44
|
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The `UseEuiValidatableControl` hook should be used in scenarios where
|
|
48
|
+
* we *cannot* control where the validated `<input>` is rendered (e.g., ReactDatePicker)
|
|
49
|
+
* and instead need to access the input via a ref and pass the element in directly
|
|
50
|
+
*/
|
|
46
51
|
EuiValidatableControl.propTypes = {
|
|
47
52
|
className: PropTypes.string,
|
|
48
53
|
"aria-label": PropTypes.string,
|
|
49
54
|
"data-test-subj": PropTypes.string,
|
|
50
55
|
css: PropTypes.any,
|
|
51
56
|
isInvalid: PropTypes.bool,
|
|
52
|
-
/**
|
|
53
|
-
* ReactNode to render as this component's content
|
|
54
|
-
*/
|
|
55
57
|
children: PropTypes.shape({
|
|
56
58
|
ref: PropTypes.any
|
|
57
59
|
}).isRequired
|
|
60
|
+
};
|
|
61
|
+
export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
62
|
+
var isInvalid = _ref2.isInvalid,
|
|
63
|
+
controlEl = _ref2.controlEl;
|
|
64
|
+
useSetControlValidity({
|
|
65
|
+
controlEl: controlEl,
|
|
66
|
+
isInvalid: isInvalid
|
|
67
|
+
});
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (!controlEl) return;
|
|
70
|
+
if (typeof isInvalid === 'boolean') {
|
|
71
|
+
controlEl.setAttribute('aria-invalid', String(isInvalid));
|
|
72
|
+
} else {
|
|
73
|
+
controlEl.removeAttribute('aria-invalid');
|
|
74
|
+
}
|
|
75
|
+
}, [isInvalid, controlEl]);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Internal `setCustomValidity` helper
|
|
80
|
+
*/
|
|
81
|
+
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
82
|
+
var controlEl = _ref3.controlEl,
|
|
83
|
+
isInvalid = _ref3.isInvalid;
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (isInvalid) {
|
|
89
|
+
controlEl.setCustomValidity('Invalid');
|
|
90
|
+
} else {
|
|
91
|
+
controlEl.setCustomValidity('');
|
|
92
|
+
}
|
|
93
|
+
}, [isInvalid, controlEl]);
|
|
58
94
|
};
|
|
@@ -12,7 +12,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/// <reference types="
|
|
15
|
+
/// <reference types="cypress" />
|
|
16
|
+
/// <reference types="cypress-real-events" />
|
|
17
|
+
/// <reference types="../../../cypress/support" />
|
|
16
18
|
|
|
17
19
|
import React, { useState } from 'react';
|
|
18
20
|
import { EuiAvatar } from '../avatar';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiIcon } from './icon';
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/// <reference types="
|
|
9
|
+
/// <reference types="cypress" />
|
|
10
|
+
/// <reference types="cypress-real-events" />
|
|
11
|
+
/// <reference types="../../../cypress/support" />
|
|
10
12
|
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { EuiImage } from './image';
|
package/es/components/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
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';
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
};
|