@elastic/eui 95.7.0 → 95.8.0-backport.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 +0 -1163
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -1163
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/es/components/combo_box/combo_box_input/combo_box_input.styles.js +1 -5
- package/es/components/datagrid/controls/column_selector.js +1 -2
- package/es/components/datagrid/data_grid.a11y.js +2 -2
- package/es/components/date_picker/date_picker.js +11 -11
- package/es/components/date_picker/date_picker.styles.js +14 -2
- package/es/components/date_picker/date_picker_range.js +2 -1
- package/es/components/date_picker/date_picker_range.styles.js +17 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +14 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.styles.js +4 -4
- package/es/components/form/checkbox/checkbox.js +28 -25
- package/es/components/form/checkbox/checkbox.styles.js +62 -0
- package/es/components/form/described_form_group/described_form_group.js +17 -9
- package/es/components/form/described_form_group/described_form_group.styles.js +26 -0
- package/es/components/form/field_number/field_number.js +1 -0
- package/es/components/form/field_number/field_number.styles.js +2 -1
- package/es/components/form/field_password/field_password.js +6 -3
- package/es/components/form/field_search/field_search.js +39 -29
- package/es/components/form/field_text/field_text.js +1 -0
- package/es/components/form/form.js +7 -4
- package/es/components/form/form.styles.js +87 -39
- package/es/components/form/form_control_layout/_num_icons.js +7 -33
- package/es/components/form/form_control_layout/form_control_layout.js +67 -32
- package/es/components/form/form_control_layout/form_control_layout.styles.js +72 -0
- package/es/components/form/form_control_layout/form_control_layout_clear_button.js +20 -23
- package/es/components/form/form_control_layout/form_control_layout_clear_button.styles.js +22 -0
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +30 -5
- package/es/components/form/form_control_layout/form_control_layout_delimited.js +37 -7
- package/es/components/form/form_control_layout/form_control_layout_delimited.styles.js +52 -0
- package/es/components/form/form_control_layout/form_control_layout_icons.js +33 -13
- package/es/components/form/form_control_layout/form_control_layout_icons.styles.js +54 -0
- package/es/components/form/form_error_text/form_error_text.js +4 -0
- package/es/components/form/form_error_text/form_error_text.styles.js +16 -0
- package/es/components/form/form_fieldset/form_legend.js +6 -2
- package/es/components/form/form_fieldset/form_legend.styles.js +20 -0
- package/es/components/form/form_help_text/form_help_text.js +4 -0
- package/es/components/form/form_help_text/form_help_text.styles.js +16 -0
- package/es/components/form/form_label/form_label.js +6 -0
- package/es/components/form/form_label/form_label.styles.js +38 -0
- package/es/components/form/form_row/form_row.js +156 -223
- package/es/components/form/form_row/form_row.styles.js +49 -0
- package/es/components/form/radio/radio.js +21 -14
- package/es/components/form/radio/radio.styles.js +34 -0
- package/es/components/form/range/range.styles.js +1 -1
- package/es/components/form/range/range_input.styles.js +1 -1
- package/es/components/form/range/range_slider.styles.js +1 -4
- package/es/components/form/range/range_thumb.styles.js +1 -4
- package/es/components/form/switch/switch.js +43 -24
- package/es/components/form/switch/switch.styles.js +226 -0
- package/es/components/form/text_area/text_area.js +1 -0
- package/es/components/form/text_area/text_area.styles.js +1 -1
- package/es/components/header/header_links/header_link.js +9 -13
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_links/header_links.styles.js +1 -1
- package/es/services/emotion/clone_element.js +5 -3
- package/eui.d.ts +403 -112
- package/i18ntokens.json +48 -30
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/lib/components/combo_box/combo_box_input/combo_box_input.styles.js +1 -5
- package/lib/components/datagrid/controls/column_selector.js +1 -2
- package/lib/components/datagrid/data_grid.a11y.js +2 -2
- package/lib/components/date_picker/date_picker.js +11 -11
- package/lib/components/date_picker/date_picker.styles.js +14 -2
- package/lib/components/date_picker/date_picker_range.js +2 -1
- package/lib/components/date_picker/date_picker_range.styles.js +17 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +14 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +4 -4
- package/lib/components/form/checkbox/checkbox.js +27 -23
- package/lib/components/form/checkbox/checkbox.styles.js +66 -0
- package/lib/components/form/described_form_group/described_form_group.js +17 -9
- package/lib/components/form/described_form_group/described_form_group.styles.js +32 -0
- package/lib/components/form/field_number/field_number.js +1 -0
- package/lib/components/form/field_number/field_number.styles.js +2 -1
- package/lib/components/form/field_password/field_password.js +6 -3
- package/lib/components/form/field_search/field_search.js +39 -29
- package/lib/components/form/field_text/field_text.js +1 -0
- package/lib/components/form/form.js +6 -3
- package/lib/components/form/form.styles.js +88 -40
- package/lib/components/form/form_control_layout/_num_icons.js +8 -33
- package/lib/components/form/form_control_layout/form_control_layout.js +65 -31
- package/lib/components/form/form_control_layout/form_control_layout.styles.js +76 -0
- package/lib/components/form/form_control_layout/form_control_layout_clear_button.js +20 -23
- package/lib/components/form/form_control_layout/form_control_layout_clear_button.styles.js +28 -0
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +34 -11
- package/lib/components/form/form_control_layout/form_control_layout_delimited.js +36 -9
- package/lib/components/form/form_control_layout/form_control_layout_delimited.styles.js +56 -0
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +33 -13
- package/lib/components/form/form_control_layout/form_control_layout_icons.styles.js +58 -0
- package/lib/components/form/form_error_text/form_error_text.js +4 -0
- package/lib/components/form/form_error_text/form_error_text.styles.js +22 -0
- package/lib/components/form/form_fieldset/form_legend.js +6 -2
- package/lib/components/form/form_fieldset/form_legend.styles.js +26 -0
- package/lib/components/form/form_help_text/form_help_text.js +4 -0
- package/lib/components/form/form_help_text/form_help_text.styles.js +22 -0
- package/lib/components/form/form_label/form_label.js +6 -0
- package/lib/components/form/form_label/form_label.styles.js +43 -0
- package/lib/components/form/form_row/form_row.js +161 -226
- package/lib/components/form/form_row/form_row.styles.js +55 -0
- package/lib/components/form/radio/radio.js +21 -14
- package/lib/components/form/radio/radio.styles.js +40 -0
- package/lib/components/form/range/range.styles.js +1 -1
- package/lib/components/form/range/range_input.styles.js +1 -1
- package/lib/components/form/range/range_slider.styles.js +1 -4
- package/lib/components/form/range/range_thumb.styles.js +1 -4
- package/lib/components/form/switch/switch.js +46 -26
- package/lib/components/form/switch/switch.styles.js +230 -0
- package/lib/components/form/text_area/text_area.js +1 -0
- package/lib/components/form/text_area/text_area.styles.js +1 -1
- package/lib/components/header/header_links/header_link.js +9 -13
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_links/header_links.styles.js +1 -1
- package/lib/services/emotion/clone_element.js +5 -3
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.styles.js +1 -5
- package/optimize/es/components/datagrid/controls/column_selector.js +1 -2
- package/optimize/es/components/datagrid/data_grid.a11y.js +2 -2
- package/optimize/es/components/date_picker/date_picker.js +6 -9
- package/optimize/es/components/date_picker/date_picker.styles.js +14 -2
- package/optimize/es/components/date_picker/date_picker_range.js +2 -1
- package/optimize/es/components/date_picker/date_picker_range.styles.js +17 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +13 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.styles.js +4 -4
- package/optimize/es/components/form/checkbox/checkbox.js +28 -25
- package/optimize/es/components/form/checkbox/checkbox.styles.js +62 -0
- package/optimize/es/components/form/described_form_group/described_form_group.js +17 -9
- package/optimize/es/components/form/described_form_group/described_form_group.styles.js +26 -0
- package/optimize/es/components/form/field_number/field_number.js +1 -0
- package/optimize/es/components/form/field_number/field_number.styles.js +2 -1
- package/optimize/es/components/form/field_password/field_password.js +6 -3
- package/optimize/es/components/form/field_search/field_search.js +39 -29
- package/optimize/es/components/form/field_text/field_text.js +1 -0
- package/optimize/es/components/form/form.js +7 -4
- package/optimize/es/components/form/form.styles.js +87 -39
- package/optimize/es/components/form/form_control_layout/_num_icons.js +7 -33
- package/optimize/es/components/form/form_control_layout/form_control_layout.js +44 -29
- package/optimize/es/components/form/form_control_layout/form_control_layout.styles.js +72 -0
- package/optimize/es/components/form/form_control_layout/form_control_layout_clear_button.js +19 -22
- package/optimize/es/components/form/form_control_layout/form_control_layout_clear_button.styles.js +22 -0
- package/optimize/es/components/form/form_control_layout/form_control_layout_custom_icon.js +29 -4
- package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +34 -7
- package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.styles.js +52 -0
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +25 -11
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.styles.js +54 -0
- package/optimize/es/components/form/form_error_text/form_error_text.js +4 -0
- package/optimize/es/components/form/form_error_text/form_error_text.styles.js +16 -0
- package/optimize/es/components/form/form_fieldset/form_legend.js +6 -2
- package/optimize/es/components/form/form_fieldset/form_legend.styles.js +20 -0
- package/optimize/es/components/form/form_help_text/form_help_text.js +4 -0
- package/optimize/es/components/form/form_help_text/form_help_text.styles.js +16 -0
- package/optimize/es/components/form/form_label/form_label.js +6 -0
- package/optimize/es/components/form/form_label/form_label.styles.js +37 -0
- package/optimize/es/components/form/form_row/form_row.js +135 -201
- package/optimize/es/components/form/form_row/form_row.styles.js +49 -0
- package/optimize/es/components/form/radio/radio.js +21 -14
- package/optimize/es/components/form/radio/radio.styles.js +34 -0
- package/optimize/es/components/form/range/range.styles.js +1 -1
- package/optimize/es/components/form/range/range_input.styles.js +1 -1
- package/optimize/es/components/form/range/range_slider.styles.js +1 -4
- package/optimize/es/components/form/range/range_thumb.styles.js +1 -4
- package/optimize/es/components/form/switch/switch.js +29 -23
- package/optimize/es/components/form/switch/switch.styles.js +226 -0
- package/optimize/es/components/form/text_area/text_area.js +1 -0
- package/optimize/es/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/es/components/header/header_links/header_link.js +9 -10
- package/optimize/es/components/header/header_links/header_links.js +1 -1
- package/optimize/es/components/header/header_links/header_links.styles.js +1 -1
- package/optimize/es/services/emotion/clone_element.js +5 -3
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.styles.js +1 -5
- package/optimize/lib/components/datagrid/controls/column_selector.js +1 -2
- package/optimize/lib/components/datagrid/data_grid.a11y.js +2 -2
- package/optimize/lib/components/date_picker/date_picker.js +6 -9
- package/optimize/lib/components/date_picker/date_picker.styles.js +14 -2
- package/optimize/lib/components/date_picker/date_picker_range.js +2 -1
- package/optimize/lib/components/date_picker/date_picker_range.styles.js +17 -4
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +13 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +4 -4
- package/optimize/lib/components/form/checkbox/checkbox.js +27 -23
- package/optimize/lib/components/form/checkbox/checkbox.styles.js +66 -0
- package/optimize/lib/components/form/described_form_group/described_form_group.js +17 -9
- package/optimize/lib/components/form/described_form_group/described_form_group.styles.js +32 -0
- package/optimize/lib/components/form/field_number/field_number.js +1 -0
- package/optimize/lib/components/form/field_number/field_number.styles.js +2 -1
- package/optimize/lib/components/form/field_password/field_password.js +6 -3
- package/optimize/lib/components/form/field_search/field_search.js +39 -29
- package/optimize/lib/components/form/field_text/field_text.js +1 -0
- package/optimize/lib/components/form/form.js +6 -3
- package/optimize/lib/components/form/form.styles.js +88 -40
- package/optimize/lib/components/form/form_control_layout/_num_icons.js +8 -33
- package/optimize/lib/components/form/form_control_layout/form_control_layout.js +43 -28
- package/optimize/lib/components/form/form_control_layout/form_control_layout.styles.js +76 -0
- package/optimize/lib/components/form/form_control_layout/form_control_layout_clear_button.js +19 -22
- package/optimize/lib/components/form/form_control_layout/form_control_layout_clear_button.styles.js +28 -0
- package/optimize/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +29 -6
- package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +34 -10
- package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.styles.js +56 -0
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +25 -11
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.styles.js +58 -0
- package/optimize/lib/components/form/form_error_text/form_error_text.js +4 -0
- package/optimize/lib/components/form/form_error_text/form_error_text.styles.js +22 -0
- package/optimize/lib/components/form/form_fieldset/form_legend.js +6 -2
- package/optimize/lib/components/form/form_fieldset/form_legend.styles.js +26 -0
- package/optimize/lib/components/form/form_help_text/form_help_text.js +4 -0
- package/optimize/lib/components/form/form_help_text/form_help_text.styles.js +22 -0
- package/optimize/lib/components/form/form_label/form_label.js +6 -0
- package/optimize/lib/components/form/form_label/form_label.styles.js +43 -0
- package/optimize/lib/components/form/form_row/form_row.js +136 -201
- package/optimize/lib/components/form/form_row/form_row.styles.js +55 -0
- package/optimize/lib/components/form/radio/radio.js +21 -14
- package/optimize/lib/components/form/radio/radio.styles.js +40 -0
- package/optimize/lib/components/form/range/range.styles.js +1 -1
- package/optimize/lib/components/form/range/range_input.styles.js +1 -1
- package/optimize/lib/components/form/range/range_slider.styles.js +1 -4
- package/optimize/lib/components/form/range/range_thumb.styles.js +1 -4
- package/optimize/lib/components/form/switch/switch.js +32 -25
- package/optimize/lib/components/form/switch/switch.styles.js +230 -0
- package/optimize/lib/components/form/text_area/text_area.js +1 -0
- package/optimize/lib/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/lib/components/header/header_links/header_link.js +9 -10
- package/optimize/lib/components/header/header_links/header_links.js +1 -1
- package/optimize/lib/components/header/header_links/header_links.styles.js +1 -1
- package/optimize/lib/services/emotion/clone_element.js +5 -3
- package/package.json +3 -2
- package/src/components/datagrid/controls/_data_grid_toolbar.scss +1 -1
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_form.scss +0 -99
- package/src/global_styling/mixins/_index.scss +0 -1
- package/src/global_styling/variables/_form.scss +0 -21
- package/src/themes/amsterdam/global_styling/mixins/_index.scss +0 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -3
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/test-env/components/combo_box/combo_box_input/combo_box_input.styles.js +1 -5
- package/test-env/components/datagrid/controls/column_selector.js +1 -2
- package/test-env/components/datagrid/data_grid.a11y.js +2 -2
- package/test-env/components/date_picker/date_picker.js +6 -9
- package/test-env/components/date_picker/date_picker.styles.js +14 -2
- package/test-env/components/date_picker/date_picker_range.js +2 -1
- package/test-env/components/date_picker/date_picker_range.styles.js +17 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +13 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.styles.js +4 -4
- package/test-env/components/form/checkbox/checkbox.js +27 -23
- package/test-env/components/form/checkbox/checkbox.styles.js +66 -0
- package/test-env/components/form/described_form_group/described_form_group.js +17 -9
- package/test-env/components/form/described_form_group/described_form_group.styles.js +32 -0
- package/test-env/components/form/field_number/field_number.js +1 -0
- package/test-env/components/form/field_number/field_number.styles.js +2 -1
- package/test-env/components/form/field_password/field_password.js +6 -3
- package/test-env/components/form/field_search/field_search.js +39 -29
- package/test-env/components/form/field_text/field_text.js +1 -0
- package/test-env/components/form/form.js +6 -3
- package/test-env/components/form/form.styles.js +88 -40
- package/test-env/components/form/form_control_layout/_num_icons.js +8 -33
- package/test-env/components/form/form_control_layout/form_control_layout.js +58 -31
- package/test-env/components/form/form_control_layout/form_control_layout.styles.js +76 -0
- package/test-env/components/form/form_control_layout/form_control_layout_clear_button.js +20 -23
- package/test-env/components/form/form_control_layout/form_control_layout_clear_button.styles.js +28 -0
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +30 -7
- package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +34 -10
- package/test-env/components/form/form_control_layout/form_control_layout_delimited.styles.js +56 -0
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +28 -13
- package/test-env/components/form/form_control_layout/form_control_layout_icons.styles.js +58 -0
- package/test-env/components/form/form_error_text/form_error_text.js +4 -0
- package/test-env/components/form/form_error_text/form_error_text.styles.js +22 -0
- package/test-env/components/form/form_fieldset/form_legend.js +6 -2
- package/test-env/components/form/form_fieldset/form_legend.styles.js +26 -0
- package/test-env/components/form/form_help_text/form_help_text.js +4 -0
- package/test-env/components/form/form_help_text/form_help_text.styles.js +22 -0
- package/test-env/components/form/form_label/form_label.js +6 -0
- package/test-env/components/form/form_label/form_label.styles.js +43 -0
- package/test-env/components/form/form_row/form_row.js +153 -216
- package/test-env/components/form/form_row/form_row.styles.js +55 -0
- package/test-env/components/form/radio/radio.js +21 -14
- package/test-env/components/form/radio/radio.styles.js +40 -0
- package/test-env/components/form/range/range.styles.js +1 -1
- package/test-env/components/form/range/range_input.styles.js +1 -1
- package/test-env/components/form/range/range_slider.styles.js +1 -4
- package/test-env/components/form/range/range_thumb.styles.js +1 -4
- package/test-env/components/form/switch/switch.js +41 -26
- package/test-env/components/form/switch/switch.styles.js +230 -0
- package/test-env/components/form/text_area/text_area.js +1 -0
- package/test-env/components/form/text_area/text_area.styles.js +1 -1
- package/test-env/components/header/header_links/header_link.js +9 -10
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_links/header_links.styles.js +1 -1
- package/test-env/services/emotion/clone_element.js +5 -3
- package/src/components/form/_form.scss +0 -8
- package/src/components/form/_index.scss +0 -11
- package/src/components/form/checkbox/_checkbox.scss +0 -115
- package/src/components/form/checkbox/_index.scss +0 -1
- package/src/components/form/described_form_group/_described_form_group.scss +0 -34
- package/src/components/form/described_form_group/_index.scss +0 -1
- package/src/components/form/form_control_layout/_form_control_layout.scss +0 -203
- package/src/components/form/form_control_layout/_form_control_layout_clear_button.scss +0 -7
- package/src/components/form/form_control_layout/_form_control_layout_custom_icon.scss +0 -24
- package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +0 -67
- package/src/components/form/form_control_layout/_form_control_layout_icons.scss +0 -54
- package/src/components/form/form_control_layout/_index.scss +0 -5
- package/src/components/form/form_error_text/_form_error_text.scss +0 -5
- package/src/components/form/form_error_text/_index.scss +0 -1
- package/src/components/form/form_fieldset/_form_legend.scss +0 -11
- package/src/components/form/form_fieldset/_index.scss +0 -1
- package/src/components/form/form_help_text/_form_help_text.scss +0 -5
- package/src/components/form/form_help_text/_index.scss +0 -1
- package/src/components/form/form_label/_form_label.scss +0 -25
- package/src/components/form/form_label/_index.scss +0 -1
- package/src/components/form/form_row/_form_row.scss +0 -102
- package/src/components/form/form_row/_index.scss +0 -1
- package/src/components/form/radio/_index.scss +0 -1
- package/src/components/form/radio/_radio.scss +0 -87
- package/src/components/form/switch/_index.scss +0 -1
- package/src/components/form/switch/_switch.scss +0 -212
- package/src/global_styling/mixins/_icons.scss +0 -17
- package/src/themes/amsterdam/overrides/_form_control_layout.scss +0 -112
- package/src/themes/amsterdam/overrides/_form_control_layout_delimited.scss +0 -42
- package/src/themes/amsterdam/overrides/_form_controls.scss +0 -19
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
var _excluded = ["children", "helpText", "isInvalid", "error", "label", "labelType", "labelAppend", "hasEmptyLabelSpace", "fullWidth", "
|
|
2
|
-
function
|
|
1
|
+
var _excluded = ["className", "children", "helpText", "isInvalid", "error", "label", "labelType", "labelAppend", "hasEmptyLabelSpace", "fullWidth", "describedByIds", "display", "hasChildLabel", "id", "isDisabled"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
5
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
7
6
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
10
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
|
-
function
|
|
10
|
-
function
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
13
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
14
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
14
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
23
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
15
|
/*
|
|
28
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
29
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -32,206 +20,149 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
32
20
|
* Side Public License, v 1.
|
|
33
21
|
*/
|
|
34
22
|
|
|
35
|
-
import React, { cloneElement,
|
|
23
|
+
import React, { cloneElement, Children, useState, useCallback, useMemo } from 'react';
|
|
36
24
|
import PropTypes from "prop-types";
|
|
37
25
|
import classNames from 'classnames';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
26
|
+
import { useGeneratedHtmlId, useEuiMemoizedStyles } from '../../../services';
|
|
27
|
+
import { EuiSpacer } from '../../spacer';
|
|
40
28
|
import { EuiFormHelpText } from '../form_help_text';
|
|
41
29
|
import { EuiFormErrorText } from '../form_error_text';
|
|
42
30
|
import { EuiFormLabel } from '../form_label';
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
31
|
+
import { useFormContext } from '../eui_form_context';
|
|
32
|
+
import { euiFormRowStyles } from './form_row.styles';
|
|
45
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export var EuiFormRow =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
34
|
+
export var DISPLAYS = ['row', 'columnCompressed', 'center', 'centerCompressed',
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated
|
|
37
|
+
*/
|
|
38
|
+
'columnCompressedSwitch',
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
'rowCompressed'];
|
|
43
|
+
export var EuiFormRow = function EuiFormRow(_ref) {
|
|
44
|
+
var className = _ref.className,
|
|
45
|
+
children = _ref.children,
|
|
46
|
+
helpText = _ref.helpText,
|
|
47
|
+
isInvalid = _ref.isInvalid,
|
|
48
|
+
error = _ref.error,
|
|
49
|
+
label = _ref.label,
|
|
50
|
+
_ref$labelType = _ref.labelType,
|
|
51
|
+
labelType = _ref$labelType === void 0 ? 'label' : _ref$labelType,
|
|
52
|
+
labelAppend = _ref.labelAppend,
|
|
53
|
+
_ref$hasEmptyLabelSpa = _ref.hasEmptyLabelSpace,
|
|
54
|
+
hasEmptyLabelSpace = _ref$hasEmptyLabelSpa === void 0 ? false : _ref$hasEmptyLabelSpa,
|
|
55
|
+
_fullWidth = _ref.fullWidth,
|
|
56
|
+
describedByIds = _ref.describedByIds,
|
|
57
|
+
_ref$display = _ref.display,
|
|
58
|
+
display = _ref$display === void 0 ? 'row' : _ref$display,
|
|
59
|
+
_ref$hasChildLabel = _ref.hasChildLabel,
|
|
60
|
+
hasChildLabel = _ref$hasChildLabel === void 0 ? true : _ref$hasChildLabel,
|
|
61
|
+
propsId = _ref.id,
|
|
62
|
+
isDisabled = _ref.isDisabled,
|
|
63
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
+
var _useFormContext = useFormContext(),
|
|
65
|
+
defaultFullWidth = _useFormContext.defaultFullWidth;
|
|
66
|
+
var fullWidth = _fullWidth !== null && _fullWidth !== void 0 ? _fullWidth : defaultFullWidth;
|
|
67
|
+
var id = useGeneratedHtmlId({
|
|
68
|
+
conditionalId: propsId
|
|
69
|
+
});
|
|
70
|
+
var hasLabel = label || labelAppend;
|
|
71
|
+
var _useState = useState(false),
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
isFocused = _useState2[0],
|
|
74
|
+
setIsFocused = _useState2[1];
|
|
75
|
+
var onFocusWithin = useCallback(function () {
|
|
76
|
+
return setIsFocused(true);
|
|
77
|
+
}, []);
|
|
78
|
+
var onBlurWithin = useCallback(function () {
|
|
79
|
+
return setIsFocused(false);
|
|
80
|
+
}, []);
|
|
81
|
+
var classes = classNames('euiFormRow', {
|
|
82
|
+
'euiFormRow--hasEmptyLabelSpace': hasEmptyLabelSpace,
|
|
83
|
+
'euiFormRow--hasLabel': hasLabel
|
|
84
|
+
}, className);
|
|
85
|
+
var styles = useEuiMemoizedStyles(euiFormRowStyles);
|
|
86
|
+
var cssStyles = [styles.euiFormRow, fullWidth ? styles.fullWidth : styles.formWidth, styles[display]];
|
|
87
|
+
var optionalHelpTexts = useMemo(function () {
|
|
88
|
+
if (!helpText) return;
|
|
89
|
+
var helpTexts = Array.isArray(helpText) ? helpText : [helpText];
|
|
90
|
+
return helpTexts.map(function (helpText, i) {
|
|
91
|
+
var key = typeof helpText === 'string' ? helpText : i;
|
|
92
|
+
return ___EmotionJSX(EuiFormHelpText, {
|
|
93
|
+
key: key,
|
|
94
|
+
id: "".concat(id, "-help-").concat(i),
|
|
95
|
+
className: "euiFormRow__text"
|
|
96
|
+
}, helpText);
|
|
66
97
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
} else {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
98
|
+
}, [helpText, id]);
|
|
99
|
+
var optionalErrors = useMemo(function () {
|
|
100
|
+
if (!(error && isInvalid)) return;
|
|
101
|
+
var errorTexts = Array.isArray(error) ? error : [error];
|
|
102
|
+
return errorTexts.map(function (error, i) {
|
|
103
|
+
var key = typeof error === 'string' ? error : i;
|
|
104
|
+
return ___EmotionJSX(EuiFormErrorText, {
|
|
105
|
+
key: key,
|
|
106
|
+
id: "".concat(id, "-error-").concat(i),
|
|
107
|
+
className: "euiFormRow__text"
|
|
108
|
+
}, error);
|
|
83
109
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_this.setState({
|
|
91
|
-
isFocused: false
|
|
110
|
+
}, [error, isInvalid, id]);
|
|
111
|
+
var ariaDescribedBy = useMemo(function () {
|
|
112
|
+
var describingIds = _toConsumableArray(describedByIds || []);
|
|
113
|
+
if (optionalHelpTexts !== null && optionalHelpTexts !== void 0 && optionalHelpTexts.length) {
|
|
114
|
+
optionalHelpTexts.forEach(function (optionalHelpText) {
|
|
115
|
+
return describingIds.push(optionalHelpText.props.id);
|
|
92
116
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return _createClass(EuiFormRow, [{
|
|
98
|
-
key: "render",
|
|
99
|
-
value: function render() {
|
|
100
|
-
var _ref3, _child$props$disabled;
|
|
101
|
-
var _ref2 = this.context,
|
|
102
|
-
defaultFullWidth = _ref2.defaultFullWidth;
|
|
103
|
-
var _this$props = this.props,
|
|
104
|
-
children = _this$props.children,
|
|
105
|
-
helpText = _this$props.helpText,
|
|
106
|
-
isInvalid = _this$props.isInvalid,
|
|
107
|
-
error = _this$props.error,
|
|
108
|
-
label = _this$props.label,
|
|
109
|
-
labelType = _this$props.labelType,
|
|
110
|
-
labelAppend = _this$props.labelAppend,
|
|
111
|
-
hasEmptyLabelSpace = _this$props.hasEmptyLabelSpace,
|
|
112
|
-
_this$props$fullWidth = _this$props.fullWidth,
|
|
113
|
-
fullWidth = _this$props$fullWidth === void 0 ? defaultFullWidth : _this$props$fullWidth,
|
|
114
|
-
className = _this$props.className,
|
|
115
|
-
describedByIds = _this$props.describedByIds,
|
|
116
|
-
display = _this$props.display,
|
|
117
|
-
hasChildLabel = _this$props.hasChildLabel,
|
|
118
|
-
propsId = _this$props.id,
|
|
119
|
-
isDisabled = _this$props.isDisabled,
|
|
120
|
-
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
121
|
-
var id = this.state.id;
|
|
122
|
-
var hasLabel = label || labelAppend;
|
|
123
|
-
var classes = classNames('euiFormRow', {
|
|
124
|
-
'euiFormRow--hasEmptyLabelSpace': hasEmptyLabelSpace,
|
|
125
|
-
'euiFormRow--fullWidth': fullWidth,
|
|
126
|
-
'euiFormRow--hasLabel': hasLabel
|
|
127
|
-
}, displayToClassNameMap[display],
|
|
128
|
-
// Safe use of ! as default prop is 'row'
|
|
129
|
-
className);
|
|
130
|
-
var optionalHelpTexts;
|
|
131
|
-
if (helpText) {
|
|
132
|
-
var helpTexts = Array.isArray(helpText) ? helpText : [helpText];
|
|
133
|
-
optionalHelpTexts = helpTexts.map(function (helpText, i) {
|
|
134
|
-
var key = typeof helpText === 'string' ? helpText : i;
|
|
135
|
-
return ___EmotionJSX(EuiFormHelpText, {
|
|
136
|
-
key: key,
|
|
137
|
-
id: "".concat(id, "-help-").concat(i),
|
|
138
|
-
className: "euiFormRow__text"
|
|
139
|
-
}, helpText);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
var optionalErrors;
|
|
143
|
-
if (error && isInvalid) {
|
|
144
|
-
var errorTexts = Array.isArray(error) ? error : [error];
|
|
145
|
-
optionalErrors = errorTexts.map(function (error, i) {
|
|
146
|
-
var key = typeof error === 'string' ? error : i;
|
|
147
|
-
return ___EmotionJSX(EuiFormErrorText, {
|
|
148
|
-
key: key,
|
|
149
|
-
id: "".concat(id, "-error-").concat(i),
|
|
150
|
-
className: "euiFormRow__text"
|
|
151
|
-
}, error);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
var optionalLabel;
|
|
155
|
-
var isLegend = label && labelType === 'legend' ? true : false;
|
|
156
|
-
var labelId = "".concat(id, "-label");
|
|
157
|
-
if (hasLabel) {
|
|
158
|
-
var labelProps = {};
|
|
159
|
-
if (isLegend) {
|
|
160
|
-
labelProps = {
|
|
161
|
-
type: labelType
|
|
162
|
-
};
|
|
163
|
-
} else {
|
|
164
|
-
labelProps = _objectSpread(_objectSpread({
|
|
165
|
-
htmlFor: hasChildLabel ? id : undefined
|
|
166
|
-
}, !isDisabled && {
|
|
167
|
-
isFocused: this.state.isFocused
|
|
168
|
-
}), {}, {
|
|
169
|
-
// If the row is disabled, don't pass the isFocused state.
|
|
170
|
-
type: labelType
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
optionalLabel = ___EmotionJSX("div", {
|
|
174
|
-
className: "euiFormRow__labelWrapper"
|
|
175
|
-
}, ___EmotionJSX(EuiFormLabel, _extends({
|
|
176
|
-
className: "euiFormRow__label",
|
|
177
|
-
isInvalid: isInvalid,
|
|
178
|
-
isDisabled: isDisabled,
|
|
179
|
-
"aria-invalid": isInvalid,
|
|
180
|
-
id: labelId
|
|
181
|
-
}, labelProps), label), labelAppend && ' ', labelAppend);
|
|
182
|
-
}
|
|
183
|
-
var optionalProps = {};
|
|
184
|
-
/**
|
|
185
|
-
* Safe use of ! as default prop is []
|
|
186
|
-
*/
|
|
187
|
-
var describingIds = _toConsumableArray(describedByIds);
|
|
188
|
-
if (optionalHelpTexts) {
|
|
189
|
-
optionalHelpTexts.forEach(function (optionalHelpText) {
|
|
190
|
-
return describingIds.push(optionalHelpText.props.id);
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
if (optionalErrors) {
|
|
194
|
-
optionalErrors.forEach(function (error) {
|
|
195
|
-
return describingIds.push(error.props.id);
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (describingIds.length > 0) {
|
|
199
|
-
optionalProps['aria-describedby'] = describingIds.join(' ');
|
|
200
|
-
}
|
|
201
|
-
var child = Children.only(children);
|
|
202
|
-
var field = /*#__PURE__*/cloneElement(child, _objectSpread({
|
|
203
|
-
id: id,
|
|
204
|
-
// Allow the child's disabled or isDisabled prop to supercede the `isDisabled`
|
|
205
|
-
disabled: (_ref3 = (_child$props$disabled = child.props.disabled) !== null && _child$props$disabled !== void 0 ? _child$props$disabled : child.props.isDisabled) !== null && _ref3 !== void 0 ? _ref3 : isDisabled,
|
|
206
|
-
onFocus: this.onFocus,
|
|
207
|
-
onBlur: this.onBlur
|
|
208
|
-
}, optionalProps));
|
|
209
|
-
var fieldWrapperClasses = classNames('euiFormRow__fieldWrapper', {
|
|
210
|
-
euiFormRow__fieldWrapperDisplayOnly:
|
|
211
|
-
/**
|
|
212
|
-
* Safe use of ! as default prop is 'row'
|
|
213
|
-
*/
|
|
214
|
-
display.startsWith('center')
|
|
117
|
+
}
|
|
118
|
+
if (optionalErrors !== null && optionalErrors !== void 0 && optionalErrors.length) {
|
|
119
|
+
optionalErrors.forEach(function (error) {
|
|
120
|
+
return describingIds.push(error.props.id);
|
|
215
121
|
});
|
|
216
|
-
var sharedProps = {
|
|
217
|
-
className: classes,
|
|
218
|
-
id: "".concat(id, "-row")
|
|
219
|
-
};
|
|
220
|
-
var contents = ___EmotionJSX(React.Fragment, null, optionalLabel, ___EmotionJSX("div", {
|
|
221
|
-
className: fieldWrapperClasses
|
|
222
|
-
}, field, optionalErrors, optionalHelpTexts));
|
|
223
|
-
return labelType === 'legend' ? ___EmotionJSX("fieldset", _extends({}, sharedProps, rest), contents) : ___EmotionJSX("div", _extends({}, sharedProps, rest), contents);
|
|
224
122
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
123
|
+
if (describingIds.length) {
|
|
124
|
+
return describingIds.join(' ');
|
|
125
|
+
}
|
|
126
|
+
}, [describedByIds, optionalHelpTexts, optionalErrors]);
|
|
127
|
+
var field = useMemo(function () {
|
|
128
|
+
var _ref2, _child$props$disabled;
|
|
129
|
+
var child = Children.only(children);
|
|
130
|
+
return /*#__PURE__*/cloneElement(child, {
|
|
131
|
+
id: id,
|
|
132
|
+
// Allow the child's disabled or isDisabled prop to supercede the `isDisabled`
|
|
133
|
+
disabled: (_ref2 = (_child$props$disabled = child.props.disabled) !== null && _child$props$disabled !== void 0 ? _child$props$disabled : child.props.isDisabled) !== null && _ref2 !== void 0 ? _ref2 : isDisabled,
|
|
134
|
+
'aria-describedby': ariaDescribedBy
|
|
135
|
+
});
|
|
136
|
+
}, [children, id, isDisabled, ariaDescribedBy]);
|
|
137
|
+
var Element = labelType === 'legend' ? 'fieldset' : 'div';
|
|
138
|
+
return ___EmotionJSX(Element, _extends({
|
|
139
|
+
css: cssStyles,
|
|
140
|
+
className: classes,
|
|
141
|
+
id: "".concat(id, "-row")
|
|
142
|
+
}, rest), hasLabel ? ___EmotionJSX("div", {
|
|
143
|
+
className: "euiFormRow__labelWrapper"
|
|
144
|
+
}, ___EmotionJSX(EuiFormLabel, _extends({
|
|
145
|
+
className: "euiFormRow__label",
|
|
146
|
+
"aria-invalid": isInvalid,
|
|
147
|
+
isInvalid: isInvalid,
|
|
148
|
+
isDisabled: isDisabled,
|
|
149
|
+
isFocused: isFocused && !isDisabled,
|
|
150
|
+
id: "".concat(id, "-label")
|
|
151
|
+
// ExclusiveUnion shenanigans
|
|
152
|
+
}, labelType === 'legend' ? {
|
|
153
|
+
type: labelType
|
|
154
|
+
} : {
|
|
155
|
+
type: labelType,
|
|
156
|
+
htmlFor: hasChildLabel ? id : undefined
|
|
157
|
+
}), label), labelAppend && ' ', labelAppend) : hasEmptyLabelSpace && ___EmotionJSX(EuiSpacer, {
|
|
158
|
+
size: "m",
|
|
159
|
+
className: "euiFormRow__labelWrapper"
|
|
160
|
+
}), ___EmotionJSX("div", {
|
|
161
|
+
className: "euiFormRow__fieldWrapper",
|
|
162
|
+
onFocus: onFocusWithin,
|
|
163
|
+
onBlur: onBlurWithin
|
|
164
|
+
}, field, optionalErrors, optionalHelpTexts));
|
|
165
|
+
};
|
|
235
166
|
EuiFormRow.propTypes = {
|
|
236
167
|
/**
|
|
237
168
|
* Defaults to rendering a `<label>` but if passed `'legend'` for labelType,
|
|
@@ -243,24 +174,26 @@ EuiFormRow.propTypes = {
|
|
|
243
174
|
"data-test-subj": PropTypes.string,
|
|
244
175
|
css: PropTypes.any,
|
|
245
176
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
*
|
|
177
|
+
* - `columnCompressed` creates a compressed and horizontal layout
|
|
178
|
+
* - `columnCompressedSwitch` - **deprecated**, use `columnCompressed` instead
|
|
179
|
+
* - `center`/`centerCompressed` helps align non-input content better with inline form layouts
|
|
180
|
+
* - `rowCompressed` - **deprecated**, does not currently affect styling
|
|
181
|
+
*/
|
|
182
|
+
/**
|
|
183
|
+
* - `columnCompressed` creates a compressed and horizontal layout
|
|
184
|
+
* - `columnCompressedSwitch` - **deprecated**, use `columnCompressed` instead
|
|
185
|
+
* - `center`/`centerCompressed` helps align non-input content better with inline form layouts
|
|
186
|
+
* - `rowCompressed` - **deprecated**, does not currently affect styling
|
|
187
|
+
*/
|
|
188
|
+
display: PropTypes.any,
|
|
189
|
+
/**
|
|
190
|
+
* Useful for inline form layouts, primarily for content that
|
|
191
|
+
* needs to be aligned with inputs but does not need a label
|
|
253
192
|
*/
|
|
254
193
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* and horizontal layout is needed.
|
|
258
|
-
* Set to `center` or `centerCompressed` to align non-input
|
|
259
|
-
* content better with inline rows.
|
|
260
|
-
* Set to `columnCompressedSwitch` if the form control being passed
|
|
261
|
-
* as the child is a switch.
|
|
194
|
+
* Useful for inline form layouts, primarily for content that
|
|
195
|
+
* needs to be aligned with inputs but does not need a label
|
|
262
196
|
*/
|
|
263
|
-
display: PropTypes.oneOf(["row", "rowCompressed", "columnCompressed", "center", "centerCompressed", "columnCompressedSwitch"]),
|
|
264
197
|
hasEmptyLabelSpace: PropTypes.bool,
|
|
265
198
|
/**
|
|
266
199
|
* Expand to fill 100% of the parent.
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import { logicalCSS } from '../../../global_styling';
|
|
11
|
+
import { euiFormVariables } from '../form.styles';
|
|
12
|
+
export var euiFormRowStyles = function euiFormRowStyles(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
var _euiFormVariables = euiFormVariables(euiThemeContext),
|
|
15
|
+
maxWidth = _euiFormVariables.maxWidth,
|
|
16
|
+
controlHeight = _euiFormVariables.controlHeight,
|
|
17
|
+
controlCompressedHeight = _euiFormVariables.controlCompressedHeight;
|
|
18
|
+
return {
|
|
19
|
+
euiFormRow: /*#__PURE__*/css("display:flex;+.euiButton{", logicalCSS('margin-top', euiTheme.size.base), ";};label:euiFormRow;"),
|
|
20
|
+
// Skip css`` to avoid generating an Emotion className
|
|
21
|
+
formWidth: "\n ".concat(logicalCSS('max-width', maxWidth), "\n "),
|
|
22
|
+
fullWidth: /*#__PURE__*/css(logicalCSS('max-width', '100%'), ";;label:fullWidth;"),
|
|
23
|
+
// Skip css`` to avoid generating an extra className
|
|
24
|
+
row: "\n flex-direction: column;\n row-gap: ".concat(euiTheme.size.xs, ";\n\n .euiFormRow__labelWrapper {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n + .euiFormRow {\n ").concat(logicalCSS('margin-top', euiTheme.size.base), "\n }\n "),
|
|
25
|
+
// No difference from the uncompressed row for this current theme AFAICT
|
|
26
|
+
// TODO: Deprecate prop
|
|
27
|
+
get rowCompressed() {
|
|
28
|
+
return this.row;
|
|
29
|
+
},
|
|
30
|
+
columnCompressed: /*#__PURE__*/css("flex-direction:row;align-items:stretch;column-gap:", euiTheme.size.s, ";.euiFormRow__label{hyphens:auto;}.euiFormRow__labelWrapper{flex-basis:calc(33% - ", euiTheme.size.s, ");", logicalCSS('min-width', 0), " line-height:", controlCompressedHeight, ";}.euiFormRow__fieldWrapper{flex-basis:67%;", logicalCSS('min-width', 0), ";}+.euiFormRow{", logicalCSS('margin-top', euiTheme.size.s), ";}&:has(.euiSwitch){&:not(:first-child){", logicalCSS('margin-top', euiTheme.size.m), ";}&:not(:last-child){", logicalCSS('margin-bottom', euiTheme.size.m), ";}.euiFormRow__labelWrapper{line-height:", euiTheme.size.base, ";}};label:columnCompressed;"),
|
|
31
|
+
// Handled by :has CSS now rather than a separate modifier/prop
|
|
32
|
+
// TODO: Deprecate prop
|
|
33
|
+
get columnCompressedSwitch() {
|
|
34
|
+
return this.columnCompressed;
|
|
35
|
+
},
|
|
36
|
+
// Center display is primarily for inline form rows, which may have have
|
|
37
|
+
// field content that is shorter than form controls (e.g. switches, text),
|
|
38
|
+
// and should vertically center said content
|
|
39
|
+
centerDisplayCss: function centerDisplayCss(compressed) {
|
|
40
|
+
return "\n .euiFormRow__fieldWrapper {\n display: flex;\n align-items: center;\n ".concat(logicalCSS('min-height', compressed ? controlCompressedHeight : controlHeight), "\n }\n ");
|
|
41
|
+
},
|
|
42
|
+
get center() {
|
|
43
|
+
return /*#__PURE__*/css(this.row, " ", this.centerDisplayCss(false), ";;label:center;");
|
|
44
|
+
},
|
|
45
|
+
get centerCompressed() {
|
|
46
|
+
return /*#__PURE__*/css(this.row, " ", this.centerDisplayCss(true), ";;label:centerCompressed;");
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -13,6 +13,9 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
17
|
+
import { EuiIcon } from '../../icon';
|
|
18
|
+
import { euiRadioStyles } from './radio.styles';
|
|
16
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
20
|
export var EuiRadio = function EuiRadio(_ref) {
|
|
18
21
|
var className = _ref.className,
|
|
@@ -26,20 +29,22 @@ export var EuiRadio = function EuiRadio(_ref) {
|
|
|
26
29
|
autoFocus = _ref.autoFocus,
|
|
27
30
|
labelProps = _ref.labelProps,
|
|
28
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
var classes = classNames('euiRadio',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
var classes = classNames('euiRadio', className);
|
|
33
|
+
var styles = useEuiMemoizedStyles(euiRadioStyles);
|
|
34
|
+
var inputStyles = [styles.input.euiRadio__circle, disabled ? checked ? styles.input.disabled.selected : styles.input.disabled.unselected : checked ? styles.input.enabled.selected : styles.input.enabled.unselected];
|
|
32
35
|
var labelClasses = classNames('euiRadio__label', labelProps === null || labelProps === void 0 ? void 0 : labelProps.className);
|
|
33
|
-
var
|
|
34
|
-
if (label) {
|
|
35
|
-
optionalLabel = ___EmotionJSX("label", _extends({}, labelProps, {
|
|
36
|
-
className: labelClasses,
|
|
37
|
-
htmlFor: id
|
|
38
|
-
}), label);
|
|
39
|
-
}
|
|
36
|
+
var labelStyles = [styles.label.euiRadio__label, disabled ? styles.label.disabled : styles.label.enabled, labelProps === null || labelProps === void 0 ? void 0 : labelProps.css];
|
|
40
37
|
return ___EmotionJSX("div", _extends({
|
|
38
|
+
css: styles.euiRadio,
|
|
41
39
|
className: classes
|
|
42
|
-
}, rest), ___EmotionJSX("
|
|
40
|
+
}, rest), ___EmotionJSX("div", {
|
|
41
|
+
css: inputStyles,
|
|
42
|
+
className: "euiRadio__circle"
|
|
43
|
+
}, ___EmotionJSX(EuiIcon, {
|
|
44
|
+
css: styles.input.euiRadio__icon,
|
|
45
|
+
type: "dot"
|
|
46
|
+
}), ___EmotionJSX("input", {
|
|
47
|
+
css: styles.input.euiRadio__input,
|
|
43
48
|
className: "euiRadio__input",
|
|
44
49
|
type: "radio",
|
|
45
50
|
id: id,
|
|
@@ -49,9 +54,11 @@ export var EuiRadio = function EuiRadio(_ref) {
|
|
|
49
54
|
onChange: onChange,
|
|
50
55
|
disabled: disabled,
|
|
51
56
|
autoFocus: autoFocus
|
|
52
|
-
}), ___EmotionJSX("
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
})), label && ___EmotionJSX("label", _extends({}, labelProps, {
|
|
58
|
+
css: labelStyles,
|
|
59
|
+
className: labelClasses,
|
|
60
|
+
htmlFor: id
|
|
61
|
+
}), label));
|
|
55
62
|
};
|
|
56
63
|
EuiRadio.propTypes = {
|
|
57
64
|
className: PropTypes.string,
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import { euiFormCustomControlStyles } from '../form.styles';
|
|
11
|
+
export var euiRadioStyles = function euiRadioStyles(euiThemeContext) {
|
|
12
|
+
var controlStyles = euiFormCustomControlStyles(euiThemeContext);
|
|
13
|
+
return {
|
|
14
|
+
euiRadio: /*#__PURE__*/css(controlStyles.wrapper, ";label:euiRadio;"),
|
|
15
|
+
input: {
|
|
16
|
+
euiRadio__circle: /*#__PURE__*/css(controlStyles.input.fauxInput, " border-radius:50%;;label:euiRadio__circle;"),
|
|
17
|
+
enabled: {
|
|
18
|
+
selected: /*#__PURE__*/css(controlStyles.input.enabled.selected, ";label:selected;"),
|
|
19
|
+
unselected: /*#__PURE__*/css(controlStyles.input.enabled.unselected, ";label:unselected;")
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
selected: /*#__PURE__*/css(controlStyles.input.disabled.selected, ";label:selected;"),
|
|
23
|
+
unselected: /*#__PURE__*/css(controlStyles.input.disabled.unselected, ";label:unselected;")
|
|
24
|
+
},
|
|
25
|
+
euiRadio__icon: /*#__PURE__*/css(controlStyles.input.icon, ";label:euiRadio__icon;"),
|
|
26
|
+
euiRadio__input: /*#__PURE__*/css(controlStyles.input.hiddenInput, ";label:euiRadio__input;")
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
euiRadio__label: /*#__PURE__*/css(controlStyles.label.label, ";label:euiRadio__label;"),
|
|
30
|
+
enabled: controlStyles.label.enabled,
|
|
31
|
+
disabled: /*#__PURE__*/css(controlStyles.label.disabled, ";label:disabled;")
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -79,7 +79,7 @@ export var euiRangeThumbFocusBoxShadow = function euiRangeThumbFocusBoxShadow(eu
|
|
|
79
79
|
};
|
|
80
80
|
export var euiRangeThumbStyle = function euiRangeThumbStyle(euiThemeContext) {
|
|
81
81
|
var range = euiRangeVariables(euiThemeContext);
|
|
82
|
-
return "\n ".concat(euiRangeThumbBoxShadow(euiThemeContext), ";\n ").concat(euiRangeThumbBorder(euiThemeContext), ";\n cursor: pointer;\n background-color: ").concat(range.thumbBackgroundColor, ";\n padding: 0;\n block-size: ").concat(range.thumbHeight, ";\n inline-size: ").concat(range.thumbWidth, ";\n box-sizing: border-box; // required for firefox or the border makes the width and height to increase\n ");
|
|
82
|
+
return "\n ".concat(euiRangeThumbBoxShadow(euiThemeContext), ";\n ").concat(euiRangeThumbBorder(euiThemeContext), ";\n border-radius: 50%;\n cursor: pointer;\n background-color: ").concat(range.thumbBackgroundColor, ";\n padding: 0;\n block-size: ").concat(range.thumbHeight, ";\n inline-size: ").concat(range.thumbWidth, ";\n box-sizing: border-box; // required for firefox or the border makes the width and height to increase\n ");
|
|
83
83
|
};
|
|
84
84
|
export var euiRangeThumbPerBrowser = function euiRangeThumbPerBrowser(content) {
|
|
85
85
|
return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb { ").concat(content, "; }\n &::-ms-thumb {").concat(content, "; }\n ");
|
|
@@ -10,6 +10,6 @@ import { css } from '@emotion/react';
|
|
|
10
10
|
export var euiRangeInputStyles = function euiRangeInputStyles(_ref) {
|
|
11
11
|
var euiTheme = _ref.euiTheme;
|
|
12
12
|
return {
|
|
13
|
-
euiRangeInput: /*#__PURE__*/css("inline-size:auto;min-inline-size:", euiTheme.base * 4, "px;.euiRange__popover &{
|
|
13
|
+
euiRangeInput: /*#__PURE__*/css("inline-size:auto;min-inline-size:", euiTheme.base * 4, "px;.euiRange__popover &,.euiDualRange__popover &{inline-size:100%;};label:euiRangeInput;")
|
|
14
14
|
};
|
|
15
15
|
};
|
|
@@ -8,15 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
10
|
import { transparentize } from '../../../services';
|
|
11
|
-
import { euiCustomControl } from '../form.styles';
|
|
12
11
|
import { euiRangeThumbStyle, euiRangeThumbPerBrowser, euiRangeVariables, euiRangeTrackPerBrowser, euiRangeThumbFocus } from './range.styles';
|
|
13
12
|
export var euiRangeSliderStyles = function euiRangeSliderStyles(euiThemeContext) {
|
|
14
13
|
var range = euiRangeVariables(euiThemeContext);
|
|
15
14
|
return {
|
|
16
15
|
// Base
|
|
17
|
-
euiRangeSlider: /*#__PURE__*/css("appearance:none;background:transparent;inline-size:100%;block-size:100%;position:relative;cursor:pointer;z-index:", range.thumbZIndex, ";", euiRangeThumbPerBrowser("\n ".concat(
|
|
18
|
-
type: 'round'
|
|
19
|
-
}), "\n ").concat(euiRangeThumbStyle(euiThemeContext), "\n ")), " &:disabled{cursor:not-allowed;", euiRangeThumbPerBrowser('cursor: not-allowed'), ";}&::-webkit-slider-thumb{-webkit-appearance:none;}&:focus{outline:none;}&:focus-visible{", euiRangeThumbPerBrowser(euiRangeThumbFocus(euiThemeContext)), " &~.euiRangeTooltip .euiRangeTooltip__value{transform:translateX(0) translateY(-50%) scale(1.1);}};label:euiRangeSlider;"),
|
|
16
|
+
euiRangeSlider: /*#__PURE__*/css("appearance:none;background:transparent;inline-size:100%;block-size:100%;position:relative;cursor:pointer;z-index:", range.thumbZIndex, ";", euiRangeThumbPerBrowser("\n ".concat(euiRangeThumbStyle(euiThemeContext), "\n ")), " &:disabled{cursor:not-allowed;", euiRangeThumbPerBrowser('cursor: not-allowed'), ";}&::-webkit-slider-thumb{-webkit-appearance:none;}&:focus{outline:none;}&:focus-visible{", euiRangeThumbPerBrowser(euiRangeThumbFocus(euiThemeContext)), " &~.euiRangeTooltip .euiRangeTooltip__value{transform:translateX(0) translateY(-50%) scale(1.1);}};label:euiRangeSlider;"),
|
|
20
17
|
hasTicks: /*#__PURE__*/css("block-size:", range.thumbHeight, ";;label:hasTicks;"),
|
|
21
18
|
hasRange: /*#__PURE__*/css(euiRangeTrackPerBrowser("\n background-color: transparent;\n border-color: ".concat(transparentize(range.trackBorderColor, 0.6), "\n ")), ";;label:hasRange;"),
|
|
22
19
|
hasLevels: /*#__PURE__*/css(euiRangeThumbPerBrowser("background-color: ".concat(range.thumbBackgroundColor)), ";;label:hasLevels;")
|
|
@@ -10,7 +10,6 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { mathWithUnits } from '../../../global_styling';
|
|
12
12
|
import { euiRangeThumbStyle, euiRangeThumbFocus, euiRangeVariables } from './range.styles';
|
|
13
|
-
import { euiCustomControl } from '../form.styles';
|
|
14
13
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
15
14
|
name: "9ugg7u-hasTicks",
|
|
16
15
|
styles: "inset-block-start:0;margin-block-start:0;label:hasTicks;"
|
|
@@ -23,9 +22,7 @@ export var euiRangeThumbStyles = function euiRangeThumbStyles(euiThemeContext) {
|
|
|
23
22
|
var range = euiRangeVariables(euiThemeContext);
|
|
24
23
|
return {
|
|
25
24
|
// Base
|
|
26
|
-
euiRangeThumb: /*#__PURE__*/css(
|
|
27
|
-
type: 'round'
|
|
28
|
-
}), " ", euiRangeThumbStyle(euiThemeContext), " content:'';position:absolute;inset-inline-start:0;inset-block-start:50%;margin-block-start:", mathWithUnits(range.thumbHeight, function (x) {
|
|
25
|
+
euiRangeThumb: /*#__PURE__*/css(euiRangeThumbStyle(euiThemeContext), " content:'';position:absolute;inset-inline-start:0;inset-block-start:50%;margin-block-start:", mathWithUnits(range.thumbHeight, function (x) {
|
|
29
26
|
return x / 2 * -1;
|
|
30
27
|
}), ";pointer-events:none;z-index:", range.thumbZIndex, ";&:focus{", euiRangeThumbFocus(euiThemeContext), " outline:none;};label:euiRangeThumb;"),
|
|
31
28
|
hasTicks: _ref
|