@linzjs/lui 21.33.0 → 21.34.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/CHANGELOG.md +7 -0
- package/dist/assets/icons/copy_titles_to_here.svg +1 -0
- package/dist/assets/svg-content.d.ts +1 -1
- package/dist/assets/svg-content.tsx +7 -0
- package/dist/components/LuiModal/LuiAlertModalV2.d.ts +7 -0
- package/dist/components/LuiModal/LuiModalV2.d.ts +26 -0
- package/dist/components/common/Hooks.d.ts +1 -0
- package/dist/hooks/useClickedOutsideElement.d.ts +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -28
- package/dist/index.js.map +1 -1
- package/dist/lui.css +82 -0
- package/dist/lui.css.map +1 -1
- package/dist/lui.esm.js +114 -29
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Components/Modal/modal-v2.scss +105 -0
- package/dist/scss/base.scss +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [21.34.0](https://github.com/linz/lui/compare/v21.33.0...v21.34.0) (2024-06-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Luiicon 050624 ([#1123](https://github.com/linz/lui/issues/1123)) ([b06e4e3](https://github.com/linz/lui/commit/b06e4e395c66e4ae806d65a2c0707dd34cf09e0f))
|
|
7
|
+
|
|
1
8
|
# [21.33.0](https://github.com/linz/lui/compare/v21.32.0...v21.33.0) (2024-05-29)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24"><path fill="#000" d="M7.6 18.6 9 20l4-4-4-4-1.4 1.4L9.2 15H3v2h6.2zM15 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zM6 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3z"/></svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare type LuiIconName = string | 'ic_account_circle' | 'ic_add' | 'ic_add_adopt' | 'ic_add_area_interest' | 'ic_add_circle' | 'ic_add_circle_outline' | 'ic_add_irregular_image' | 'ic_add_label' | 'ic_add_line' | 'ic_add_multiple' | 'ic_add_page' | 'ic_add_rectangle' | 'ic_add_rt_lines' | 'ic_add_to_list' | 'ic_add_to_xml' | 'ic_added_to_list' | 'ic_admin' | 'ic_alias' | 'ic_alias_unselected' | 'ic_annotations' | 'ic_apps' | 'ic_arrow_back' | 'ic_arrow_back_ios' | 'ic_arrow_back_left' | 'ic_arrow_drop_down' | 'ic_arrow_drop_right' | 'ic_arrow_drop_up' | 'ic_arrow_forward_ios' | 'ic_arrow_forward_right' | 'ic_attach_file' | 'ic_attachment' | 'ic_auth_and_instruct' | 'ic_balance_parcel' | 'ic_basemap_off' | 'ic_blackwhite_greyscale' | 'ic_blocked' | 'ic_border_color' | 'ic_cancel_clear' | 'ic_cancel_outline' | 'ic_capture_area' | 'ic_cart_view' | 'ic_certify_and_sign' | 'ic_change_password' | 'ic_check' | 'ic_check_circle' | 'ic_check_circle_outline' | 'ic_checklist' | 'ic_clear' | 'ic_close_list' | 'ic_columns' | 'ic_control_point' | 'ic_copy' | 'ic_corporate_fare' | 'ic_create' | 'ic_create_new_list' | 'ic_csv_file' | 'ic_data_display_threshold' | 'ic_data_display_threshold_high_urban' | 'ic_data_display_threshold_low_large_rural' | 'ic_data_display_threshold_medium_rural' | 'ic_dealings' | 'ic_deceased' | 'ic_deceased_fill' | 'ic_define_diagrams' | 'ic_define_nonprimary_diagram_circle' | 'ic_define_nonprimary_diagram_polygon' | 'ic_define_nonprimary_diagram_rectangle' | 'ic_define_primary_diagram_circle' | 'ic_define_primary_diagram_polygon' | 'ic_define_primary_diagram_rectangle' | 'ic_define_survey_diagram_circle' | 'ic_define_survey_diagram_polygon' | 'ic_define_survey_diagram_rectangle' | 'ic_delete_forever' | 'ic_delete_outline' | 'ic_delete_page' | 'ic_delete_solid' | 'ic_description' | 'ic_dollar_round' | 'ic_double_arrow_left' | 'ic_double_arrow_right' | 'ic_double_tick' | 'ic_drag_handle' | 'ic_drag_indicator' | 'ic_draw_abuttal' | 'ic_draw_irregular_line' | 'ic_draw_rt_bdry' | 'ic_email' | 'ic_enabled_users' | 'ic_error' | 'ic_error_outline' | 'ic_expand_less' | 'ic_expand_more' | 'ic_fast_forward' | 'ic_feedback_lightbulb' | 'ic_feedback_lightbulb_alt' | 'ic_file_attached' | 'ic_file_attached_outline' | 'ic_filter_list' | 'ic_flag' | 'ic_format_colour' | 'ic_format_lines_text' | 'ic_forward' | 'ic_fullscreen_frame' | 'ic_generate_title' | 'ic_grid_view' | 'ic_help_outline' | 'ic_history' | 'ic_hourglass' | 'ic_info' | 'ic_info_outline' | 'ic_insert_into_sheet' | 'ic_insert_invitation' | 'ic_insert_photo' | 'ic_instruments_roles' | 'ic_keyboard_arrow_down' | 'ic_keyboard_arrow_left' | 'ic_keyboard_arrow_right' | 'ic_keyboard_arrow_up' | 'ic_label_diagrams' | 'ic_label_settings' | 'ic_labels_off' | 'ic_labels_on' | 'ic_land_record_search' | 'ic_launch_modal' | 'ic_launch_new window_open' | 'ic_layers' | 'ic_layers_user_defined' | 'ic_layout_plan_sheets' | 'ic_left' | 'ic_left_col' | 'ic_line_arc' | 'ic_line_arc_reverse' | 'ic_line_irregular' | 'ic_line_vector' | 'ic_link' | 'ic_list_add' | 'ic_list_clear' | 'ic_list_notepad' | 'ic_list_view' | 'ic_lists_folder' | 'ic_locate' | 'ic_located_in_spatial' | 'ic_lock' | 'ic_lock_alt' | 'ic_log_out' | 'ic_manage_adjust' | 'ic_manage_labels' | 'ic_maori_land' | 'ic_mark_linking' | 'ic_marks' | 'ic_memorials' | 'ic_menu' | 'ic_message_received' | 'ic_minimise' | 'ic_misclose_error' | 'ic_more_vert' | 'ic_multi_factor_authentication_mfa' | 'ic_navigate_before' | 'ic_navigate_next' | 'ic_new_work_item' | 'ic_note_add' | 'ic_notice_of_change' | 'ic_notifications' | 'ic_numbered_list' | 'ic_office_building_corporate' | 'ic_open_diagrams' | 'ic_order_history' | 'ic_package' | 'ic_pan_map' | 'ic_pan_map_alt' | 'ic_parcels_existing' | 'ic_parcels_new' | 'ic_pdf' | 'ic_pdf_doc' | 'ic_pen_and_paper_sign' | 'ic_people_outline' | 'ic_person' | 'ic_person_add' | 'ic_picker' | 'ic_placeholder' | 'ic_plan_generation' | 'ic_plus_one' | 'ic_polygon_selection' | 'ic_pop_back' | 'ic_pre_validation' | 'ic_print' | 'ic_product_list' | 'ic_publish' | 'ic_push_pin' | 'ic_push_pin_remove' | 'ic_read_only' | 'ic_redo' | 'ic_refresh' | 'ic_regenerate' | 'ic_release' | 'ic_remove_circle' | 'ic_remove_circle_outline' | 'ic_remove_from_sheet' | 'ic_renumber_page' | 'ic_request' | 'ic_requisitions' | 'ic_restart' | 'ic_restore' | 'ic_rotate_sheet' | 'ic_round_selection' | 'ic_save' | 'ic_save_as' | 'ic_save_download' | 'ic_saved_area_interest' | 'ic_search' | 'ic_select_coordinates' | 'ic_select_diagram' | 'ic_select_label' | 'ic_select_line' | 'ic_select_rt_lines' | 'ic_send' | 'ic_send_email_dart' | 'ic_separator' | 'ic_settings' | 'ic_sorting_down_arrow_up' | 'ic_sorting_up_arrow_up' | 'ic_square_selection' | 'ic_subdirectory_arrow_right' | 'ic_submit' | 'ic_summary_open' | 'ic_survey' | 'ic_survey_report' | 'ic_survey_sheet' | 'ic_ta_request_sent' | 'ic_table_columns' | 'ic_tax_statement' | 'ic_tick' | 'ic_tick_and_cross' | 'ic_timeline' | 'ic_title_allocation_swap' | 'ic_title_sheet' | 'ic_toggle_off' | 'ic_toggle_on' | 'ic_tune_setting_configure' | 'ic_undo' | 'ic_unlink' | 'ic_unlock' | 'ic_upload' | 'ic_vector' | 'ic_vector_sequence' | 'ic_view' | 'ic_view_list' | 'ic_view_quilt' | 'ic_view_sidebar' | 'ic_view_week' | 'ic_visiblity_off' | 'ic_warning' | 'ic_warning_outline' | 'ic_waves' | 'ic_whats_new_updates' | 'ic_xml_file' | 'ic_zoom_centre' | 'ic_zoom_out' | 'ic_zoom_previous' | 'ic_zoomin_snippet_circle' | 'ic_zoomin_snippet_polygon' | 'ic_zoomin_snippet_rectangle' | 'ic_zoomout_snippet_circle' | 'ic_zoomout_snippet_polygon' | 'ic_zoomout_snippet_rectangle';
|
|
2
|
+
export declare type LuiIconName = string | 'ic_account_circle' | 'ic_add' | 'ic_add_adopt' | 'ic_add_area_interest' | 'ic_add_circle' | 'ic_add_circle_outline' | 'ic_add_irregular_image' | 'ic_add_label' | 'ic_add_line' | 'ic_add_multiple' | 'ic_add_page' | 'ic_add_rectangle' | 'ic_add_rt_lines' | 'ic_add_to_list' | 'ic_add_to_xml' | 'ic_added_to_list' | 'ic_admin' | 'ic_alias' | 'ic_alias_unselected' | 'ic_annotations' | 'ic_apps' | 'ic_arrow_back' | 'ic_arrow_back_ios' | 'ic_arrow_back_left' | 'ic_arrow_drop_down' | 'ic_arrow_drop_right' | 'ic_arrow_drop_up' | 'ic_arrow_forward_ios' | 'ic_arrow_forward_right' | 'ic_attach_file' | 'ic_attachment' | 'ic_auth_and_instruct' | 'ic_balance_parcel' | 'ic_basemap_off' | 'ic_blackwhite_greyscale' | 'ic_blocked' | 'ic_border_color' | 'ic_cancel_clear' | 'ic_cancel_outline' | 'ic_capture_area' | 'ic_cart_view' | 'ic_certify_and_sign' | 'ic_change_password' | 'ic_check' | 'ic_check_circle' | 'ic_check_circle_outline' | 'ic_checklist' | 'ic_clear' | 'ic_close_list' | 'ic_columns' | 'ic_control_point' | 'ic_copy' | 'ic_copy_titles_to_here' | 'ic_corporate_fare' | 'ic_create' | 'ic_create_new_list' | 'ic_csv_file' | 'ic_data_display_threshold' | 'ic_data_display_threshold_high_urban' | 'ic_data_display_threshold_low_large_rural' | 'ic_data_display_threshold_medium_rural' | 'ic_dealings' | 'ic_deceased' | 'ic_deceased_fill' | 'ic_define_diagrams' | 'ic_define_nonprimary_diagram_circle' | 'ic_define_nonprimary_diagram_polygon' | 'ic_define_nonprimary_diagram_rectangle' | 'ic_define_primary_diagram_circle' | 'ic_define_primary_diagram_polygon' | 'ic_define_primary_diagram_rectangle' | 'ic_define_survey_diagram_circle' | 'ic_define_survey_diagram_polygon' | 'ic_define_survey_diagram_rectangle' | 'ic_delete_forever' | 'ic_delete_outline' | 'ic_delete_page' | 'ic_delete_solid' | 'ic_description' | 'ic_dollar_round' | 'ic_double_arrow_left' | 'ic_double_arrow_right' | 'ic_double_tick' | 'ic_drag_handle' | 'ic_drag_indicator' | 'ic_draw_abuttal' | 'ic_draw_irregular_line' | 'ic_draw_rt_bdry' | 'ic_email' | 'ic_enabled_users' | 'ic_error' | 'ic_error_outline' | 'ic_expand_less' | 'ic_expand_more' | 'ic_fast_forward' | 'ic_feedback_lightbulb' | 'ic_feedback_lightbulb_alt' | 'ic_file_attached' | 'ic_file_attached_outline' | 'ic_filter_list' | 'ic_flag' | 'ic_format_colour' | 'ic_format_lines_text' | 'ic_forward' | 'ic_fullscreen_frame' | 'ic_generate_title' | 'ic_grid_view' | 'ic_help_outline' | 'ic_history' | 'ic_hourglass' | 'ic_info' | 'ic_info_outline' | 'ic_insert_into_sheet' | 'ic_insert_invitation' | 'ic_insert_photo' | 'ic_instruments_roles' | 'ic_keyboard_arrow_down' | 'ic_keyboard_arrow_left' | 'ic_keyboard_arrow_right' | 'ic_keyboard_arrow_up' | 'ic_label_diagrams' | 'ic_label_settings' | 'ic_labels_off' | 'ic_labels_on' | 'ic_land_record_search' | 'ic_launch_modal' | 'ic_launch_new window_open' | 'ic_layers' | 'ic_layers_user_defined' | 'ic_layout_plan_sheets' | 'ic_left' | 'ic_left_col' | 'ic_line_arc' | 'ic_line_arc_reverse' | 'ic_line_irregular' | 'ic_line_vector' | 'ic_link' | 'ic_list_add' | 'ic_list_clear' | 'ic_list_notepad' | 'ic_list_view' | 'ic_lists_folder' | 'ic_locate' | 'ic_located_in_spatial' | 'ic_lock' | 'ic_lock_alt' | 'ic_log_out' | 'ic_manage_adjust' | 'ic_manage_labels' | 'ic_maori_land' | 'ic_mark_linking' | 'ic_marks' | 'ic_memorials' | 'ic_menu' | 'ic_message_received' | 'ic_minimise' | 'ic_misclose_error' | 'ic_more_vert' | 'ic_multi_factor_authentication_mfa' | 'ic_navigate_before' | 'ic_navigate_next' | 'ic_new_work_item' | 'ic_note_add' | 'ic_notice_of_change' | 'ic_notifications' | 'ic_numbered_list' | 'ic_office_building_corporate' | 'ic_open_diagrams' | 'ic_order_history' | 'ic_package' | 'ic_pan_map' | 'ic_pan_map_alt' | 'ic_parcels_existing' | 'ic_parcels_new' | 'ic_pdf' | 'ic_pdf_doc' | 'ic_pen_and_paper_sign' | 'ic_people_outline' | 'ic_person' | 'ic_person_add' | 'ic_picker' | 'ic_placeholder' | 'ic_plan_generation' | 'ic_plus_one' | 'ic_polygon_selection' | 'ic_pop_back' | 'ic_pre_validation' | 'ic_print' | 'ic_product_list' | 'ic_publish' | 'ic_push_pin' | 'ic_push_pin_remove' | 'ic_read_only' | 'ic_redo' | 'ic_refresh' | 'ic_regenerate' | 'ic_release' | 'ic_remove_circle' | 'ic_remove_circle_outline' | 'ic_remove_from_sheet' | 'ic_renumber_page' | 'ic_request' | 'ic_requisitions' | 'ic_restart' | 'ic_restore' | 'ic_rotate_sheet' | 'ic_round_selection' | 'ic_save' | 'ic_save_as' | 'ic_save_download' | 'ic_saved_area_interest' | 'ic_search' | 'ic_select_coordinates' | 'ic_select_diagram' | 'ic_select_label' | 'ic_select_line' | 'ic_select_rt_lines' | 'ic_send' | 'ic_send_email_dart' | 'ic_separator' | 'ic_settings' | 'ic_sorting_down_arrow_up' | 'ic_sorting_up_arrow_up' | 'ic_square_selection' | 'ic_subdirectory_arrow_right' | 'ic_submit' | 'ic_summary_open' | 'ic_survey' | 'ic_survey_report' | 'ic_survey_sheet' | 'ic_ta_request_sent' | 'ic_table_columns' | 'ic_tax_statement' | 'ic_tick' | 'ic_tick_and_cross' | 'ic_timeline' | 'ic_title_allocation_swap' | 'ic_title_sheet' | 'ic_toggle_off' | 'ic_toggle_on' | 'ic_tune_setting_configure' | 'ic_undo' | 'ic_unlink' | 'ic_unlock' | 'ic_upload' | 'ic_vector' | 'ic_vector_sequence' | 'ic_view' | 'ic_view_list' | 'ic_view_quilt' | 'ic_view_sidebar' | 'ic_view_week' | 'ic_visiblity_off' | 'ic_warning' | 'ic_warning_outline' | 'ic_waves' | 'ic_whats_new_updates' | 'ic_xml_file' | 'ic_zoom_centre' | 'ic_zoom_out' | 'ic_zoom_previous' | 'ic_zoomin_snippet_circle' | 'ic_zoomin_snippet_polygon' | 'ic_zoomin_snippet_rectangle' | 'ic_zoomout_snippet_circle' | 'ic_zoomout_snippet_polygon' | 'ic_zoomout_snippet_rectangle';
|
|
3
3
|
declare type IconNameElementMap = {
|
|
4
4
|
[key in LuiIconName]?: JSX.Element;
|
|
5
5
|
};
|
|
@@ -62,6 +62,7 @@ export type LuiIconName =
|
|
|
62
62
|
| 'ic_columns'
|
|
63
63
|
| 'ic_control_point'
|
|
64
64
|
| 'ic_copy'
|
|
65
|
+
| 'ic_copy_titles_to_here'
|
|
65
66
|
| 'ic_corporate_fare'
|
|
66
67
|
| 'ic_create'
|
|
67
68
|
| 'ic_create_new_list'
|
|
@@ -617,6 +618,12 @@ iconMap['ic_copy'] = (
|
|
|
617
618
|
</svg>
|
|
618
619
|
);
|
|
619
620
|
|
|
621
|
+
iconMap['ic_copy_titles_to_here'] = (
|
|
622
|
+
<svg viewBox="0 0 24 24">
|
|
623
|
+
<path d="M7.6 18.6 9 20l4-4-4-4-1.4 1.4L9.2 15H3v2h6.2zM15 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zM6 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3z" />
|
|
624
|
+
</svg>
|
|
625
|
+
);
|
|
626
|
+
|
|
620
627
|
iconMap['ic_corporate_fare'] = (
|
|
621
628
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
622
629
|
<path d="M12 6.984V3H2.016v18h19.969V6.984h-9.984zm-2.016 12h-6v-1.969h6v1.969zm0-3.984h-6v-2.016h6V15zm0-3.984h-6V9h6v2.016zm0-4.032h-6V5.015h6v1.969zm10.032 12H12V9h8.016v9.984zM18 11.016h-3.984v1.969H18v-1.969zM18 15h-3.984v2.016H18V15z" />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { LuiModalV2Props } from './LuiModalV2';
|
|
3
|
+
export declare type LuiAlertModalLevel = 'success' | 'info' | 'warning' | 'error';
|
|
4
|
+
export declare type LuiAlertModalV2Props = Omit<LuiModalV2Props, 'headingIcon'> & {
|
|
5
|
+
level: LuiAlertModalLevel;
|
|
6
|
+
};
|
|
7
|
+
export declare const LuiAlertModalV2: FC<PropsWithChildren<LuiAlertModalV2Props>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { LuiIconProps } from '../LuiIcon/LuiIcon';
|
|
3
|
+
export declare type LuiModalV2Props = {
|
|
4
|
+
key?: string;
|
|
5
|
+
/** Default `true` */
|
|
6
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
7
|
+
/** Default `true` */
|
|
8
|
+
shouldCloseOnEsc?: boolean | 'use-keyup';
|
|
9
|
+
onClose?: () => void | Promise<void>;
|
|
10
|
+
showCloseButton?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
/** If set to true, the modal will take the full screen width. Default `false` */
|
|
13
|
+
maxWidth?: boolean;
|
|
14
|
+
headingText?: string;
|
|
15
|
+
headingIcon?: LuiIconProps;
|
|
16
|
+
helpLink?: string | (() => void | Promise<void>);
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
/** Sets the overlay to white. This is only to be used for situations when the user is working in a component and there is benefit to hiding the surrounding page. An example is editing types of instruments in the Dealings flow in LOL. */
|
|
19
|
+
lowContrast?: boolean;
|
|
20
|
+
/** By default, the modal autofocuses the first `input` or `button` inside it. Set this prop to `true` to disable that behaviour. Default `false`. */
|
|
21
|
+
preventAutoFocus?: boolean;
|
|
22
|
+
/** By default, the modal portal will be appended to the document's body, but we might need to append it to another element. This is passed the React Modal `parentSelector` prop. */
|
|
23
|
+
appendToElement?: () => HTMLElement;
|
|
24
|
+
};
|
|
25
|
+
export declare const LuiModalV2: FC<PropsWithChildren<LuiModalV2Props>>;
|
|
26
|
+
export declare const LuiModalV2Buttons: FC<PropsWithChildren<unknown>>;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @param onEscape the handler function
|
|
6
6
|
*/
|
|
7
7
|
export declare const useEscapeFunction: (onEscape: () => void) => void;
|
|
8
|
+
export declare const useEscapeFunction2: (onEscape: (e: KeyboardEvent) => void | Promise<void>, trigger?: 'keyup' | 'keydown') => void;
|
|
8
9
|
/**
|
|
9
10
|
* A hook which allows handling of click event anywhere on the page.
|
|
10
11
|
* Provides a way of handling clicks done inside or outside the element bound to the returned react ref.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MutableRefObject, RefObject } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* This hook will callback with handleClickOutside() when "mousedown" dom event occurs off the refElement
|
|
4
4
|
* usage:
|
|
@@ -11,4 +11,4 @@ import React from 'react';
|
|
|
11
11
|
return <button ref={refElement}>Click Me!</button>;
|
|
12
12
|
```
|
|
13
13
|
*/
|
|
14
|
-
export declare function useClickedOutsideElement(refElement:
|
|
14
|
+
export declare function useClickedOutsideElement(refElement: RefObject<HTMLElement> | MutableRefObject<HTMLElement>, handleClickOutside: CallableFunction): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export * from './components/LuiHeaderMenu/LuiHeaderMenus';
|
|
|
37
37
|
export * from './components/LuiHeaderMenuV2/LuiHeaderMenusV2';
|
|
38
38
|
export { LuiUpdatesSplashModal } from './components/LuiUpdateSplashModal/LuiUpdatesSplashModal';
|
|
39
39
|
export { LuiModal, LuiAlertModal, LuiAlertModalButtons, } from './components/LuiModal/LuiModal';
|
|
40
|
+
export { LuiModalV2, LuiModalV2Buttons, type LuiModalV2Props, } from './components/LuiModal/LuiModalV2';
|
|
41
|
+
export { LuiAlertModalV2, type LuiAlertModalLevel, type LuiAlertModalV2Props, } from './components/LuiModal/LuiAlertModalV2';
|
|
40
42
|
export { type ISearchInputProps, LuiSearchInput, } from './components/LuiSearchInput/LuiSearchInput';
|
|
41
43
|
export { type ISearchGroupedResult, type ISearchResult, } from './components/LuiSearchInput/ResultsDisplay';
|
|
42
44
|
export { type ISearchMenuOption, type ILuiSearchBoxProps, LuiSearchBox, } from './components/LuiSearchBox/LuiSearchBox';
|
package/dist/index.js
CHANGED
|
@@ -278,6 +278,8 @@ iconMap['ic_control_point'] = (React__default["default"].createElement("svg", {
|
|
|
278
278
|
React__default["default"].createElement("path", { d: "M21.146 1.1h-5.7c-.9 0-1.7.8-1.7 1.7v5.7c0 .9.8 1.7 1.7 1.7h5.7c.9 0 1.7-.8 1.7-1.7V2.9c.1-1-.7-1.8-1.7-1.8z" })));
|
|
279
279
|
iconMap['ic_copy'] = (React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
280
280
|
React__default["default"].createElement("path", { d: "M8.5 20h10V7c0-.55.45-1 1-1s1 .45 1 1v13c0 1.1-.9 2-2 2h-10c-.55 0-1-.45-1-1s.45-1 1-1zm-5-4V4c0-1.1.9-2 2-2h9c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2h-9c-1.1 0-2-.9-2-2zm2 0h9V4h-9v12z" })));
|
|
281
|
+
iconMap['ic_copy_titles_to_here'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24" },
|
|
282
|
+
React__default["default"].createElement("path", { d: "M7.6 18.6 9 20l4-4-4-4-1.4 1.4L9.2 15H3v2h6.2zM15 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zM6 7c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3zm0 4c-.6 0-1-.4-1-1s.4-1 1-1h5c.6 0 1 .4 1 1s-.1.6-.3.7c-.2.2-.4.3-.7.3z" })));
|
|
281
283
|
iconMap['ic_corporate_fare'] = (React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
282
284
|
React__default["default"].createElement("path", { d: "M12 6.984V3H2.016v18h19.969V6.984h-9.984zm-2.016 12h-6v-1.969h6v1.969zm0-3.984h-6v-2.016h6V15zm0-3.984h-6V9h6v2.016zm0-4.032h-6V5.015h6v1.969zm10.032 12H12V9h8.016v9.984zM18 11.016h-3.984v1.969H18v-1.969zM18 15h-3.984v2.016H18V15z" })));
|
|
283
285
|
iconMap['ic_create'] = (React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
@@ -39922,6 +39924,17 @@ var useEscapeFunction = function (onEscape) {
|
|
|
39922
39924
|
};
|
|
39923
39925
|
}, [escFunction]);
|
|
39924
39926
|
};
|
|
39927
|
+
var useEscapeFunction2 = function (onEscape, trigger) {
|
|
39928
|
+
if (trigger === void 0) { trigger = 'keydown'; }
|
|
39929
|
+
var escFunction = React.useCallback(function (event) {
|
|
39930
|
+
console.log(event.key, event, onEscape);
|
|
39931
|
+
event.key === 'Escape' && onEscape(event);
|
|
39932
|
+
}, [onEscape]);
|
|
39933
|
+
React.useEffect(function () {
|
|
39934
|
+
document.addEventListener(trigger, escFunction, false);
|
|
39935
|
+
return function () { return document.removeEventListener(trigger, escFunction, false); };
|
|
39936
|
+
}, [escFunction]);
|
|
39937
|
+
};
|
|
39925
39938
|
/**
|
|
39926
39939
|
* A hook which allows handling of click event anywhere on the page.
|
|
39927
39940
|
* Provides a way of handling clicks done inside or outside the element bound to the returned react ref.
|
|
@@ -42281,6 +42294,106 @@ var LuiModalHeader = function (props) {
|
|
|
42281
42294
|
React__default["default"].createElement(LuiIcon, { name: "ic_clear", alt: "Help", size: "lg" }))))))));
|
|
42282
42295
|
};
|
|
42283
42296
|
|
|
42297
|
+
/**
|
|
42298
|
+
* This hook will callback with handleClickOutside() when "mousedown" dom event occurs off the refElement
|
|
42299
|
+
* usage:
|
|
42300
|
+
```typescript
|
|
42301
|
+
const refElement = React.useRef<HTMLButtonElement>(null);
|
|
42302
|
+
const handleClickOutside = () => {
|
|
42303
|
+
console.log("hello world");
|
|
42304
|
+
};
|
|
42305
|
+
useClickedOutsideElement(refElement, handleClickOutside);
|
|
42306
|
+
return <button ref={refElement}>Click Me!</button>;
|
|
42307
|
+
```
|
|
42308
|
+
*/
|
|
42309
|
+
function useClickedOutsideElement(refElement, handleClickOutside) {
|
|
42310
|
+
React__default["default"].useEffect(function () {
|
|
42311
|
+
function onOutsideClicked(event) {
|
|
42312
|
+
var element = refElement.current;
|
|
42313
|
+
if (!(element === null || element === void 0 ? void 0 : element.contains(event.target))) {
|
|
42314
|
+
handleClickOutside();
|
|
42315
|
+
}
|
|
42316
|
+
}
|
|
42317
|
+
document.addEventListener('mousedown', onOutsideClicked);
|
|
42318
|
+
return function () {
|
|
42319
|
+
document.removeEventListener('mousedown', onOutsideClicked);
|
|
42320
|
+
};
|
|
42321
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42322
|
+
}, []);
|
|
42323
|
+
}
|
|
42324
|
+
|
|
42325
|
+
var _a;
|
|
42326
|
+
// this is here for the tests
|
|
42327
|
+
var isTest = typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'test';
|
|
42328
|
+
if (!isTest)
|
|
42329
|
+
Modal.setAppElement('#root');
|
|
42330
|
+
var LuiModalV2 = function (props) {
|
|
42331
|
+
var _a;
|
|
42332
|
+
var modalRef = React.useRef(null);
|
|
42333
|
+
var handleClickOutside = React.useCallback(function () { var _a; return props.shouldCloseOnOverlayClick && ((_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props)); }, [props.shouldCloseOnEsc, props.onClose]);
|
|
42334
|
+
useClickedOutsideElement(modalRef, handleClickOutside);
|
|
42335
|
+
var handleEsc = React.useCallback(function (e) {
|
|
42336
|
+
var _a;
|
|
42337
|
+
if (props.shouldCloseOnEsc !== false) {
|
|
42338
|
+
e.stopPropagation();
|
|
42339
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
42340
|
+
}
|
|
42341
|
+
}, [props.shouldCloseOnEsc, props.onClose]);
|
|
42342
|
+
useEscapeFunction2(handleEsc, props.shouldCloseOnEsc === 'use-keyup' ? 'keyup' : 'keydown');
|
|
42343
|
+
var handleAutoFocus = function (el) {
|
|
42344
|
+
if (props.preventAutoFocus)
|
|
42345
|
+
return;
|
|
42346
|
+
if (el && !el.contains(el.ownerDocument.activeElement)) {
|
|
42347
|
+
var firstFocusableElement = el.querySelector('input,button');
|
|
42348
|
+
firstFocusableElement === null || firstFocusableElement === void 0 ? void 0 : firstFocusableElement.focus();
|
|
42349
|
+
}
|
|
42350
|
+
};
|
|
42351
|
+
console.log({ props: props }, props.shouldCloseOnEsc && props.shouldCloseOnEsc !== 'use-keyup');
|
|
42352
|
+
var showCloseButton = Boolean(props.showCloseButton && props.onClose);
|
|
42353
|
+
var showHelpButton = Boolean(props.helpLink);
|
|
42354
|
+
var showButtons = showCloseButton || showHelpButton;
|
|
42355
|
+
var showHeadingIcon = props.headingIcon && !props.isLoading;
|
|
42356
|
+
return (React__default["default"].createElement(Modal, { key: props.key, isOpen: true,
|
|
42357
|
+
// disble the `shouldClose` props as we handle them ourselves
|
|
42358
|
+
shouldCloseOnOverlayClick: false, shouldCloseOnEsc: false, overlayClassName: "modal", className: props.lowContrast ? 'lui-scrim-low-contrast' : 'lui-scrim',
|
|
42359
|
+
// required to prevent warnings that are not applicable in real usage
|
|
42360
|
+
ariaHideApp: !isTest, parentSelector: props.appendToElement },
|
|
42361
|
+
React__default["default"].createElement("div", { ref: function (el) {
|
|
42362
|
+
modalRef.current = el;
|
|
42363
|
+
handleAutoFocus(el);
|
|
42364
|
+
}, className: clsx('lui-modal-v2 lui-box-shadow', props.maxWidth && 'lui-max-width', props.className) },
|
|
42365
|
+
React__default["default"].createElement("div", { className: "lui-modal-v2-header" },
|
|
42366
|
+
props.isLoading && (React__default["default"].createElement(LuiMiniSpinner, { size: 20, divProps: { className: 'lui-modal-v2-header-spinner' } })),
|
|
42367
|
+
showHeadingIcon && (React__default["default"].createElement("div", { className: "lui-modal-v2-header-icon" },
|
|
42368
|
+
React__default["default"].createElement(LuiIcon, __assign({ size: "md", name: "", alt: "Help" }, props.headingIcon, { className: clsx('', (_a = props.headingIcon) === null || _a === void 0 ? void 0 : _a.className) })))),
|
|
42369
|
+
props.headingText && (React__default["default"].createElement("h2", { className: "lui-modal-v2-header-title" }, props.headingText)),
|
|
42370
|
+
showButtons && (React__default["default"].createElement("div", { className: "lui-modal-v2-header-buttons" },
|
|
42371
|
+
showHelpButton && React__default["default"].createElement(HelpButton, { helpLink: props.helpLink }),
|
|
42372
|
+
showCloseButton && React__default["default"].createElement(CloseButton, { onClose: props.onClose })))),
|
|
42373
|
+
React__default["default"].createElement("div", { className: "lui-modal-v2-contents" }, props.children))));
|
|
42374
|
+
};
|
|
42375
|
+
var LuiModalV2Buttons = function (props) { return (React__default["default"].createElement("div", { className: "lui-modal-v2-btn-row" }, props.children)); };
|
|
42376
|
+
var HelpButton = function (props) { return (React__default["default"].createElement("button", { "aria-label": "Modal Help", title: "Help", className: "lui-modal-v2-header-help-btn", onClick: typeof props.helpLink === 'string'
|
|
42377
|
+
? function () { return window.open(props.helpLink, '_blank'); }
|
|
42378
|
+
: props.helpLink },
|
|
42379
|
+
React__default["default"].createElement(LuiIcon, { name: "ic_help_outline", alt: "Help", size: "md" }))); };
|
|
42380
|
+
var CloseButton = function (props) { return (React__default["default"].createElement("button", { "aria-label": "Modal Close", title: "Close", className: "lui-modal-v2-header-close-btn", onClick: props.onClose },
|
|
42381
|
+
React__default["default"].createElement(LuiIcon, { name: "ic_clear", alt: "Help", size: "md" }))); };
|
|
42382
|
+
|
|
42383
|
+
var LuiAlertModalV2 = function (props) {
|
|
42384
|
+
var level = props.level, className = props.className, children = props.children, rest = __rest(props, ["level", "className", "children"]);
|
|
42385
|
+
var materialIcon = getMaterialIconForLevel(level);
|
|
42386
|
+
var status = Object.keys(ICON_STATUS).includes(level)
|
|
42387
|
+
? level
|
|
42388
|
+
: 'interactive';
|
|
42389
|
+
return (React__default["default"].createElement(LuiModalV2, __assign({}, rest, { className: clsx("lui-modal-v2-".concat(level), className), headingIcon: {
|
|
42390
|
+
name: "ic_".concat(materialIcon),
|
|
42391
|
+
alt: level,
|
|
42392
|
+
size: 'md',
|
|
42393
|
+
status: status
|
|
42394
|
+
} }), children));
|
|
42395
|
+
};
|
|
42396
|
+
|
|
42284
42397
|
var css_248z$e = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n user-select: none;\n overflow: hidden;\n z-index: 1; /* Necessary for overflow: hidden to work correctly in Safari */\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: linear-gradient(\n 90deg,\n var(--base-color),\n var(--highlight-color),\n var(--base-color)\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n\n@media (prefers-reduced-motion) {\n .react-loading-skeleton {\n --pseudo-element-display: none; /* Disable animation */\n }\n}\n";
|
|
42285
42398
|
styleInject(css_248z$e);
|
|
42286
42399
|
|
|
@@ -46879,34 +46992,6 @@ var LuiTooltip = function (props) {
|
|
|
46879
46992
|
return React__default["default"].createElement(Tippy, __assign({}, tippyProps), children);
|
|
46880
46993
|
};
|
|
46881
46994
|
|
|
46882
|
-
/**
|
|
46883
|
-
* This hook will callback with handleClickOutside() when "mousedown" dom event occurs off the refElement
|
|
46884
|
-
* usage:
|
|
46885
|
-
```typescript
|
|
46886
|
-
const refElement = React.useRef<HTMLButtonElement>(null);
|
|
46887
|
-
const handleClickOutside = () => {
|
|
46888
|
-
console.log("hello world");
|
|
46889
|
-
};
|
|
46890
|
-
useClickedOutsideElement(refElement, handleClickOutside);
|
|
46891
|
-
return <button ref={refElement}>Click Me!</button>;
|
|
46892
|
-
```
|
|
46893
|
-
*/
|
|
46894
|
-
function useClickedOutsideElement(refElement, handleClickOutside) {
|
|
46895
|
-
React__default["default"].useEffect(function () {
|
|
46896
|
-
function onOutsideClicked(event) {
|
|
46897
|
-
var element = refElement.current;
|
|
46898
|
-
if (!(element === null || element === void 0 ? void 0 : element.contains(event.target))) {
|
|
46899
|
-
handleClickOutside();
|
|
46900
|
-
}
|
|
46901
|
-
}
|
|
46902
|
-
document.addEventListener('mousedown', onOutsideClicked);
|
|
46903
|
-
return function () {
|
|
46904
|
-
document.removeEventListener('mousedown', onOutsideClicked);
|
|
46905
|
-
};
|
|
46906
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46907
|
-
}, []);
|
|
46908
|
-
}
|
|
46909
|
-
|
|
46910
46995
|
var getFillClassName = function (fillVariation, backgroundFill) {
|
|
46911
46996
|
if (backgroundFill) {
|
|
46912
46997
|
return 'LuiBadge--fill';
|
|
@@ -59319,6 +59404,7 @@ exports.LuiAccordicardStatic = LuiAccordicardStatic;
|
|
|
59319
59404
|
exports.LuiAccordion = LuiAccordion;
|
|
59320
59405
|
exports.LuiAlertModal = LuiAlertModal;
|
|
59321
59406
|
exports.LuiAlertModalButtons = LuiAlertModalButtons;
|
|
59407
|
+
exports.LuiAlertModalV2 = LuiAlertModalV2;
|
|
59322
59408
|
exports.LuiAppFooterSml = LuiAppFooterSml;
|
|
59323
59409
|
exports.LuiBadge = LuiBadge;
|
|
59324
59410
|
exports.LuiBanner = LuiBanner;
|
|
@@ -59372,6 +59458,8 @@ exports.LuiMenuCloseButtonV2 = LuiMenuCloseButtonV2;
|
|
|
59372
59458
|
exports.LuiMessagingContextProvider = LuiMessagingContextProvider;
|
|
59373
59459
|
exports.LuiMiniSpinner = LuiMiniSpinner;
|
|
59374
59460
|
exports.LuiModal = LuiModal;
|
|
59461
|
+
exports.LuiModalV2 = LuiModalV2;
|
|
59462
|
+
exports.LuiModalV2Buttons = LuiModalV2Buttons;
|
|
59375
59463
|
exports.LuiMoneyInput = LuiMoneyInput;
|
|
59376
59464
|
exports.LuiMultiSwitch = LuiMultiSwitch;
|
|
59377
59465
|
exports.LuiMultiSwitchYesNo = LuiMultiSwitchYesNo;
|