@airtable/blocks 1.18.0 → 1.18.2
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 +552 -0
- package/dist/cjs/color_utils.js +21 -23
- package/dist/cjs/colors.js +4 -60
- package/dist/cjs/error_utils.js +15 -25
- package/dist/cjs/event_tracker.js +5 -11
- package/dist/cjs/global_config.js +107 -188
- package/dist/cjs/index.js +16 -40
- package/dist/cjs/injected/airtable_interface.js +1 -6
- package/dist/cjs/models/abstract_model.js +50 -81
- package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
- package/dist/cjs/models/base.js +211 -374
- package/dist/cjs/models/create_aggregators.js +53 -47
- package/dist/cjs/models/cursor.js +125 -201
- package/dist/cjs/models/field.js +256 -303
- package/dist/cjs/models/grouped_record_query_result.js +210 -286
- package/dist/cjs/models/linked_records_query_result.js +276 -454
- package/dist/cjs/models/models.js +36 -50
- package/dist/cjs/models/mutation_constants.js +5 -9
- package/dist/cjs/models/mutations.js +125 -338
- package/dist/cjs/models/object_pool.js +37 -94
- package/dist/cjs/models/record.js +132 -226
- package/dist/cjs/models/record_coloring.js +14 -19
- package/dist/cjs/models/record_query_result.js +323 -282
- package/dist/cjs/models/record_store.js +355 -688
- package/dist/cjs/models/session.js +99 -158
- package/dist/cjs/models/table.js +361 -549
- package/dist/cjs/models/table_or_view_query_result.js +410 -765
- package/dist/cjs/models/view.js +161 -204
- package/dist/cjs/models/view_data_store.js +177 -282
- package/dist/cjs/models/view_metadata_query_result.js +96 -127
- package/dist/cjs/perform_record_action.js +69 -103
- package/dist/cjs/private_utils.js +133 -223
- package/dist/cjs/sdk.js +97 -142
- package/dist/cjs/settings_button.js +30 -57
- package/dist/cjs/stats/block_stats.js +3 -15
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
- package/dist/cjs/types/airtable_interface.js +36 -8
- package/dist/cjs/types/field.js +66 -12
- package/dist/cjs/types/mutations.js +99 -6
- package/dist/cjs/types/permission_levels.js +2 -4
- package/dist/cjs/types/undo_redo.js +2 -3
- package/dist/cjs/types/view.js +16 -11
- package/dist/cjs/ui/base_provider.js +14 -9
- package/dist/cjs/ui/baymax_utils.js +107 -1102
- package/dist/cjs/ui/block_wrapper.js +30 -68
- package/dist/cjs/ui/box.js +52 -56
- package/dist/cjs/ui/button.js +60 -77
- package/dist/cjs/ui/cell_renderer.js +78 -139
- package/dist/cjs/ui/choice_token.js +45 -47
- package/dist/cjs/ui/collaborator_token.js +33 -54
- package/dist/cjs/ui/color_palette.js +58 -106
- package/dist/cjs/ui/color_palette_synced.js +41 -52
- package/dist/cjs/ui/confirmation_dialog.js +53 -69
- package/dist/cjs/ui/control_sizes.js +21 -46
- package/dist/cjs/ui/create_detect_element_resize.js +16 -50
- package/dist/cjs/ui/css_helpers.js +3 -10
- package/dist/cjs/ui/dialog.js +44 -71
- package/dist/cjs/ui/dialog_close_button.js +52 -72
- package/dist/cjs/ui/expand_record.js +4 -11
- package/dist/cjs/ui/expand_record_list.js +6 -11
- package/dist/cjs/ui/expand_record_picker_async.js +18 -35
- package/dist/cjs/ui/field_icon.js +25 -28
- package/dist/cjs/ui/field_picker.js +47 -81
- package/dist/cjs/ui/field_picker_synced.js +33 -44
- package/dist/cjs/ui/form_field.js +45 -64
- package/dist/cjs/ui/geometry/geometry.js +6 -10
- package/dist/cjs/ui/geometry/point.js +5 -13
- package/dist/cjs/ui/geometry/rect.js +7 -29
- package/dist/cjs/ui/geometry/size.js +5 -13
- package/dist/cjs/ui/global_alert.js +35 -61
- package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
- package/dist/cjs/ui/heading.js +63 -92
- package/dist/cjs/ui/icon.js +44 -66
- package/dist/cjs/ui/icon_config.js +13 -24
- package/dist/cjs/ui/initialize_block.js +23 -36
- package/dist/cjs/ui/input.js +74 -87
- package/dist/cjs/ui/input_synced.js +34 -43
- package/dist/cjs/ui/key_codes.js +4 -9
- package/dist/cjs/ui/label.js +45 -50
- package/dist/cjs/ui/link.js +74 -89
- package/dist/cjs/ui/loader.js +26 -42
- package/dist/cjs/ui/modal.js +63 -89
- package/dist/cjs/ui/model_picker_select.js +29 -47
- package/dist/cjs/ui/popover.js +98 -180
- package/dist/cjs/ui/progress_bar.js +45 -51
- package/dist/cjs/ui/record_card.js +143 -278
- package/dist/cjs/ui/record_card_list.js +117 -165
- package/dist/cjs/ui/remote_utils.js +5 -13
- package/dist/cjs/ui/sdk_context.js +7 -9
- package/dist/cjs/ui/select.js +84 -118
- package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
- package/dist/cjs/ui/select_buttons.js +54 -90
- package/dist/cjs/ui/select_buttons_synced.js +32 -41
- package/dist/cjs/ui/select_synced.js +32 -42
- package/dist/cjs/ui/switch.js +66 -84
- package/dist/cjs/ui/switch_synced.js +32 -38
- package/dist/cjs/ui/synced.js +16 -43
- package/dist/cjs/ui/system/all_styles_set.js +89 -22
- package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
- package/dist/cjs/ui/system/appearance/background_color.js +6 -12
- package/dist/cjs/ui/system/appearance/border.js +6 -12
- package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
- package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
- package/dist/cjs/ui/system/appearance/opacity.js +5 -11
- package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
- package/dist/cjs/ui/system/dimensions/height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/width.js +5 -11
- package/dist/cjs/ui/system/display.js +8 -9
- package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
- package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
- package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
- package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
- package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
- package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
- package/dist/cjs/ui/system/flex_item/flex.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
- package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
- package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
- package/dist/cjs/ui/system/flex_item/order.js +5 -11
- package/dist/cjs/ui/system/index.js +310 -362
- package/dist/cjs/ui/system/overflow.js +8 -9
- package/dist/cjs/ui/system/position/bottom.js +6 -13
- package/dist/cjs/ui/system/position/left.js +5 -12
- package/dist/cjs/ui/system/position/position.js +5 -11
- package/dist/cjs/ui/system/position/position_set.js +15 -27
- package/dist/cjs/ui/system/position/right.js +5 -12
- package/dist/cjs/ui/system/position/top.js +5 -12
- package/dist/cjs/ui/system/position/z_index.js +5 -11
- package/dist/cjs/ui/system/spacing/margin.js +5 -12
- package/dist/cjs/ui/system/spacing/padding.js +5 -12
- package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
- package/dist/cjs/ui/system/typography/font_family.js +5 -11
- package/dist/cjs/ui/system/typography/font_size.js +5 -11
- package/dist/cjs/ui/system/typography/font_style.js +5 -11
- package/dist/cjs/ui/system/typography/font_weight.js +5 -11
- package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
- package/dist/cjs/ui/system/typography/line_height.js +5 -11
- package/dist/cjs/ui/system/typography/text_align.js +5 -11
- package/dist/cjs/ui/system/typography/text_color.js +5 -11
- package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
- package/dist/cjs/ui/system/typography/text_transform.js +5 -11
- package/dist/cjs/ui/system/typography/typography_set.js +15 -31
- package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
- package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
- package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
- package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
- package/dist/cjs/ui/table_picker.js +26 -43
- package/dist/cjs/ui/table_picker_synced.js +33 -42
- package/dist/cjs/ui/text.js +59 -71
- package/dist/cjs/ui/text_button.js +80 -97
- package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
- package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
- package/dist/cjs/ui/theme/default_theme/index.js +15 -32
- package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
- package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
- package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
- package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
- package/dist/cjs/ui/theme/theme_context.js +3 -6
- package/dist/cjs/ui/theme/use_theme.js +1 -7
- package/dist/cjs/ui/tooltip.js +38 -79
- package/dist/cjs/ui/types/aria_props.js +3 -7
- package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
- package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
- package/dist/cjs/ui/ui.js +89 -130
- package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
- package/dist/cjs/ui/use_array_identity.js +0 -4
- package/dist/cjs/ui/use_base.js +4 -13
- package/dist/cjs/ui/use_cursor.js +3 -12
- package/dist/cjs/ui/use_form_field.js +4 -6
- package/dist/cjs/ui/use_global_config.js +3 -10
- package/dist/cjs/ui/use_loadable.js +59 -132
- package/dist/cjs/ui/use_record_action_data.js +6 -12
- package/dist/cjs/ui/use_records.js +23 -24
- package/dist/cjs/ui/use_session.js +6 -15
- package/dist/cjs/ui/use_settings_button.js +4 -11
- package/dist/cjs/ui/use_styled_system.js +12 -21
- package/dist/cjs/ui/use_synced.js +0 -7
- package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
- package/dist/cjs/ui/use_view_metadata.js +5 -8
- package/dist/cjs/ui/use_viewport.js +1 -7
- package/dist/cjs/ui/use_watchable.js +36 -74
- package/dist/cjs/ui/view_picker.js +44 -78
- package/dist/cjs/ui/view_picker_synced.js +33 -44
- package/dist/cjs/ui/viewport_constraint.js +37 -64
- package/dist/cjs/ui/with_hooks.js +17 -22
- package/dist/cjs/ui/with_styled_system.js +33 -60
- package/dist/cjs/undo_redo.js +12 -32
- package/dist/cjs/unstable_private_utils.js +6 -8
- package/dist/cjs/unstable_testing_utils.js +44 -57
- package/dist/cjs/viewport.js +127 -189
- package/dist/cjs/warning.js +5 -6
- package/dist/cjs/watchable.js +66 -148
- package/dist/types/src/colors.d.ts +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +1 -1
- package/dist/types/src/global_config.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +1 -1
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +1 -1
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +1 -1
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/models.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +1 -1
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_coloring.d.ts +2 -2
- package/dist/types/src/models/record_coloring.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/session.d.ts +1 -1
- package/dist/types/src/models/session.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +1 -1
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +1 -1
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/perform_record_action.d.ts +1 -1
- package/dist/types/src/perform_record_action.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +8 -8
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/settings_button.d.ts.map +1 -1
- package/dist/types/src/types/aggregators.d.ts +1 -1
- package/dist/types/src/types/aggregators.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +6 -6
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/attachment.d.ts +1 -1
- package/dist/types/src/types/attachment.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -1
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/block.d.ts +1 -1
- package/dist/types/src/types/block.d.ts.map +1 -1
- package/dist/types/src/types/collaborator.d.ts +1 -1
- package/dist/types/src/types/collaborator.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +5 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/global_config.d.ts +6 -6
- package/dist/types/src/types/global_config.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +4 -4
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/permission_levels.d.ts +1 -1
- package/dist/types/src/types/permission_levels.d.ts.map +1 -1
- package/dist/types/src/types/record.d.ts +2 -2
- package/dist/types/src/types/record.d.ts.map +1 -1
- package/dist/types/src/types/record_action_data.d.ts +1 -1
- package/dist/types/src/types/record_action_data.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/undo_redo.d.ts +1 -1
- package/dist/types/src/types/undo_redo.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +4 -4
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/base_provider.d.ts +1 -1
- package/dist/types/src/ui/base_provider.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts +2 -2
- package/dist/types/src/ui/button.d.ts +1 -1
- package/dist/types/src/ui/button.d.ts.map +1 -1
- package/dist/types/src/ui/cell_renderer.d.ts +2 -2
- package/dist/types/src/ui/choice_token.d.ts +3 -3
- package/dist/types/src/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/ui/collaborator_token.d.ts +5 -5
- package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/ui/color_palette.d.ts +2 -2
- package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
- package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
- package/dist/types/src/ui/control_sizes.d.ts +2 -2
- package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/ui/dialog.d.ts +2 -2
- package/dist/types/src/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
- package/dist/types/src/ui/field_icon.d.ts +3 -3
- package/dist/types/src/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/ui/field_picker.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts.map +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/heading.d.ts +3 -3
- package/dist/types/src/ui/heading.d.ts.map +1 -1
- package/dist/types/src/ui/icon.d.ts +1 -1
- package/dist/types/src/ui/icon_config.d.ts +39 -39
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +3 -3
- package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/ui/input.d.ts +15 -15
- package/dist/types/src/ui/input.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/loader.d.ts +1 -1
- package/dist/types/src/ui/loader.d.ts.map +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/ui/popover.d.ts +5 -5
- package/dist/types/src/ui/popover.d.ts.map +1 -1
- package/dist/types/src/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +2 -2
- package/dist/types/src/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/ui/record_card_list.d.ts +1 -1
- package/dist/types/src/ui/select.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/select_buttons.d.ts +4 -4
- package/dist/types/src/ui/switch.d.ts +1 -1
- package/dist/types/src/ui/switch.d.ts.map +1 -1
- package/dist/types/src/ui/synced.d.ts +3 -3
- package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
- package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/ui/system/display.d.ts +0 -1
- package/dist/types/src/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
- package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/types.d.ts +4 -4
- package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
- package/dist/types/src/ui/text.d.ts +3 -3
- package/dist/types/src/ui/text.d.ts.map +1 -1
- package/dist/types/src/ui/text_button.d.ts +1 -1
- package/dist/types/src/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
- package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
- package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/ui/tooltip.d.ts +3 -3
- package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/ui/use_base.d.ts.map +1 -1
- package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
- package/dist/types/src/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
- package/dist/types/src/ui/use_records.d.ts +2 -2
- package/dist/types/src/ui/use_records.d.ts.map +1 -1
- package/dist/types/src/ui/use_session.d.ts.map +1 -1
- package/dist/types/src/ui/view_picker.d.ts +2 -2
- package/dist/types/src/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +2 -2
- package/dist/types/src/viewport.d.ts.map +1 -1
- package/dist/types/src/warning.d.ts +1 -1
- package/dist/types/src/warning.d.ts.map +1 -1
- package/dist/types/stories/helpers/code_block.d.ts +2 -2
- package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
- package/dist/types/stories/helpers/example.d.ts +5 -5
- package/dist/types/stories/helpers/example.d.ts.map +1 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
- package/dist/types/stories/icon_example.d.ts +2 -2
- package/dist/types/stories/icon_example.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/package.json +26 -25
package/dist/cjs/ui/popover.js
CHANGED
|
@@ -1,107 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
10
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.filter");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.to-string");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.promise");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
18
|
-
|
|
19
11
|
Object.defineProperty(exports, "__esModule", {
|
|
20
12
|
value: true
|
|
21
13
|
});
|
|
22
|
-
exports.default = exports.
|
|
23
|
-
|
|
14
|
+
exports.default = exports.PopoverPlacements = exports.FitInWindowModes = void 0;
|
|
15
|
+
require("core-js/modules/es.object.to-string.js");
|
|
16
|
+
require("core-js/modules/es.promise.js");
|
|
24
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
25
|
-
|
|
26
|
-
require("regenerator-runtime/runtime");
|
|
27
|
-
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
28
19
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
29
|
-
|
|
30
20
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
31
|
-
|
|
32
21
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
33
|
-
|
|
34
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
35
|
-
|
|
36
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
37
|
-
|
|
38
23
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
39
|
-
|
|
40
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
41
|
-
|
|
42
25
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
43
|
-
|
|
44
26
|
var _emotion = require("emotion");
|
|
45
|
-
|
|
46
27
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
47
|
-
|
|
48
28
|
var React = _interopRequireWildcard(require("react"));
|
|
49
|
-
|
|
50
29
|
var _private_utils = require("../private_utils");
|
|
51
|
-
|
|
52
30
|
var _error_utils = require("../error_utils");
|
|
53
|
-
|
|
54
31
|
var _baymax_utils = require("./baymax_utils");
|
|
55
|
-
|
|
56
32
|
var _create_detect_element_resize = _interopRequireDefault(require("./create_detect_element_resize"));
|
|
57
|
-
|
|
58
33
|
var Geometry = _interopRequireWildcard(require("./geometry/geometry"));
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function _objectSpread(
|
|
63
|
-
|
|
34
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
35
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
36
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
38
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
39
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @module @airtable/blocks/ui: Popover */ /** */
|
|
64
40
|
// NOTE(evanhahn) I wasn't figure out a better way to document these enums
|
|
65
41
|
// with JSDoc. The @memberof directive doesn't seem to work when the token
|
|
66
42
|
// contains a period (as Popover.placements does).
|
|
67
|
-
|
|
68
43
|
/**
|
|
69
44
|
* Dictates how a {@link Tooltip} component should be positioned relative
|
|
70
45
|
* to the anchor element. Accessed via `Tooltip.placements`.
|
|
71
46
|
*/
|
|
72
47
|
// TODO (stephen): convert to createEnum
|
|
73
|
-
var PopoverPlacements
|
|
74
|
-
/**
|
|
75
|
-
* Any of the supported {@link PopoverPlacements} for horizontal positioning.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
exports.PopoverPlacements = PopoverPlacements;
|
|
79
|
-
|
|
80
|
-
(function (PopoverPlacements) {
|
|
48
|
+
var PopoverPlacements = exports.PopoverPlacements = /*#__PURE__*/function (PopoverPlacements) {
|
|
81
49
|
PopoverPlacements["TOP"] = "top";
|
|
82
50
|
PopoverPlacements["BOTTOM"] = "bottom";
|
|
83
51
|
PopoverPlacements["CENTER"] = "center";
|
|
84
52
|
PopoverPlacements["LEFT"] = "left";
|
|
85
53
|
PopoverPlacements["RIGHT"] = "right";
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
return PopoverPlacements;
|
|
55
|
+
}({});
|
|
88
56
|
/**
|
|
89
|
-
*
|
|
57
|
+
* Any of the supported {@link PopoverPlacements} for horizontal positioning.
|
|
90
58
|
*/
|
|
91
|
-
// TODO (stephen): convert to createEnum
|
|
92
|
-
var FitInWindowModes;
|
|
93
59
|
/**
|
|
94
|
-
* Any of the supported {@link
|
|
60
|
+
* Any of the supported {@link PopoverPlacements} for vertical positioning.
|
|
95
61
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Dictates how a {@link Popover} or {@link Tooltip} component should be kept within the viewport. Accessed via `Popover.fitInWindowModes` or `Tooltip.fitInWindowModes`.
|
|
64
|
+
*/
|
|
65
|
+
// TODO (stephen): convert to createEnum
|
|
66
|
+
var FitInWindowModes = exports.FitInWindowModes = /*#__PURE__*/function (FitInWindowModes) {
|
|
100
67
|
FitInWindowModes["NONE"] = "none";
|
|
101
68
|
FitInWindowModes["FLIP"] = "flip";
|
|
102
69
|
FitInWindowModes["NUDGE"] = "nudge";
|
|
103
|
-
|
|
104
|
-
|
|
70
|
+
return FitInWindowModes;
|
|
71
|
+
}({});
|
|
72
|
+
/**
|
|
73
|
+
* Any of the supported {@link FitInWindowModes}.
|
|
74
|
+
*/
|
|
75
|
+
/**
|
|
76
|
+
* Props for the {@link Popover} component.
|
|
77
|
+
*
|
|
78
|
+
* @hidden
|
|
79
|
+
*/
|
|
105
80
|
/**
|
|
106
81
|
* A popover component, which is used to "float" some content above some other content.
|
|
107
82
|
*
|
|
@@ -109,63 +84,42 @@ exports.FitInWindowModes = FitInWindowModes;
|
|
|
109
84
|
* @docsPath UI/components/Popover
|
|
110
85
|
* @component
|
|
111
86
|
*/
|
|
112
|
-
var Popover =
|
|
113
|
-
/*#__PURE__*/
|
|
114
|
-
function (_React$Component) {
|
|
115
|
-
(0, _inherits2.default)(Popover, _React$Component);
|
|
116
|
-
|
|
117
|
-
/** @hidden */
|
|
118
|
-
|
|
119
|
-
/** @hidden */
|
|
120
|
-
|
|
121
|
-
/** @hidden */
|
|
122
|
-
|
|
123
|
-
/** @hidden */
|
|
124
|
-
|
|
125
|
-
/** @internal */
|
|
126
|
-
|
|
127
|
-
/** @internal */
|
|
128
|
-
|
|
129
|
-
/** @internal */
|
|
130
|
-
|
|
131
|
-
/** @internal */
|
|
132
|
-
|
|
133
|
-
/** @internal */
|
|
134
|
-
|
|
87
|
+
var Popover = /*#__PURE__*/function (_React$Component) {
|
|
135
88
|
/** @hidden */
|
|
136
89
|
function Popover(props) {
|
|
137
90
|
var _this;
|
|
138
|
-
|
|
139
91
|
(0, _classCallCheck2.default)(this, Popover);
|
|
140
|
-
_this = (
|
|
141
|
-
|
|
142
|
-
(0, _defineProperty2.default)(
|
|
143
|
-
|
|
144
|
-
(0, _defineProperty2.default)(
|
|
145
|
-
|
|
92
|
+
_this = _callSuper(this, Popover, [props]);
|
|
93
|
+
/** @internal */
|
|
94
|
+
(0, _defineProperty2.default)(_this, "_container", void 0);
|
|
95
|
+
/** @internal */
|
|
96
|
+
(0, _defineProperty2.default)(_this, "_background", void 0);
|
|
97
|
+
/** @internal */
|
|
98
|
+
(0, _defineProperty2.default)(_this, "_popoverContent", void 0);
|
|
99
|
+
/** @internal */
|
|
100
|
+
(0, _defineProperty2.default)(_this, "_mouseDownOutsidePopover", void 0);
|
|
101
|
+
/** @internal */
|
|
102
|
+
(0, _defineProperty2.default)(_this, "_detectElementResize", void 0);
|
|
146
103
|
_this._container = null;
|
|
147
104
|
_this._background = null;
|
|
148
105
|
_this._popoverContent = null;
|
|
149
106
|
_this._mouseDownOutsidePopover = false;
|
|
150
|
-
_this._onMouseDown = _this._onMouseDown.bind(
|
|
151
|
-
_this._onMouseUp = _this._onMouseUp.bind(
|
|
152
|
-
_this._refreshContainerAsync = _this._refreshContainerAsync.bind(
|
|
107
|
+
_this._onMouseDown = _this._onMouseDown.bind(_this);
|
|
108
|
+
_this._onMouseUp = _this._onMouseUp.bind(_this);
|
|
109
|
+
_this._refreshContainerAsync = _this._refreshContainerAsync.bind(_this);
|
|
153
110
|
return _this;
|
|
154
111
|
}
|
|
155
112
|
/** @hidden */
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
(0, _createClass2.default)(Popover, [{
|
|
113
|
+
(0, _inherits2.default)(Popover, _React$Component);
|
|
114
|
+
return (0, _createClass2.default)(Popover, [{
|
|
159
115
|
key: "componentDidMount",
|
|
160
116
|
value: function componentDidMount() {
|
|
161
117
|
if (this.props.isOpen) {
|
|
162
118
|
this._createContainer();
|
|
163
119
|
}
|
|
164
|
-
|
|
165
120
|
this._refreshContainerAsync();
|
|
166
121
|
}
|
|
167
122
|
/** @hidden */
|
|
168
|
-
|
|
169
123
|
}, {
|
|
170
124
|
key: "UNSAFE_componentWillReceiveProps",
|
|
171
125
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -176,28 +130,24 @@ function (_React$Component) {
|
|
|
176
130
|
}
|
|
177
131
|
}
|
|
178
132
|
/** @hidden */
|
|
179
|
-
|
|
180
133
|
}, {
|
|
181
134
|
key: "componentDidUpdate",
|
|
182
135
|
value: function componentDidUpdate() {
|
|
183
136
|
this._refreshContainerAsync();
|
|
184
137
|
}
|
|
185
138
|
/** @hidden */
|
|
186
|
-
|
|
187
139
|
}, {
|
|
188
140
|
key: "componentWillUnmount",
|
|
189
141
|
value: function componentWillUnmount() {
|
|
190
142
|
this._destroyContainer();
|
|
191
143
|
}
|
|
192
144
|
/** @internal */
|
|
193
|
-
|
|
194
145
|
}, {
|
|
195
146
|
key: "_createContainer",
|
|
196
147
|
value: function _createContainer() {
|
|
197
148
|
if (this._container) {
|
|
198
149
|
return;
|
|
199
150
|
}
|
|
200
|
-
|
|
201
151
|
this._container = document.createElement('div');
|
|
202
152
|
var container = this._container;
|
|
203
153
|
container.setAttribute('tabIndex', '0');
|
|
@@ -207,50 +157,46 @@ function (_React$Component) {
|
|
|
207
157
|
document.body.appendChild(container);
|
|
208
158
|
window.addEventListener('scroll', this._refreshContainerAsync);
|
|
209
159
|
this._detectElementResize = (0, _create_detect_element_resize.default)();
|
|
210
|
-
|
|
211
160
|
this._detectElementResize.addResizeListener(this._anchor, this._refreshContainerAsync);
|
|
212
161
|
}
|
|
213
162
|
/** @internal */
|
|
214
|
-
|
|
215
163
|
}, {
|
|
216
164
|
key: "_destroyContainer",
|
|
217
165
|
value: function _destroyContainer() {
|
|
218
166
|
var container = this._container;
|
|
219
|
-
|
|
220
167
|
if (!container) {
|
|
221
168
|
return;
|
|
222
169
|
}
|
|
223
|
-
|
|
224
170
|
window.removeEventListener('scroll', this._refreshContainerAsync);
|
|
225
|
-
|
|
226
171
|
if (this._detectElementResize) {
|
|
227
172
|
this._detectElementResize.removeResizeListener(this._anchor, this._refreshContainerAsync);
|
|
228
173
|
}
|
|
229
|
-
|
|
230
174
|
_reactDom.default.unmountComponentAtNode(container);
|
|
231
|
-
|
|
232
175
|
container.remove();
|
|
233
176
|
this._container = null;
|
|
234
177
|
}
|
|
235
178
|
/** @internal */
|
|
236
|
-
|
|
237
179
|
}, {
|
|
238
|
-
key: "
|
|
239
|
-
|
|
180
|
+
key: "_anchor",
|
|
181
|
+
get: function get() {
|
|
182
|
+
// TODO: use a ref
|
|
183
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
184
|
+
return _reactDom.default.findDOMNode(this);
|
|
185
|
+
}
|
|
240
186
|
/** @internal */
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
187
|
+
}, {
|
|
188
|
+
key: "_refreshContainerAsync",
|
|
189
|
+
value: (function () {
|
|
190
|
+
var _refreshContainerAsync2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
191
|
+
var anchor, anchorBoundingClientRect, anchorRect, viewportRect, measurementPopover, measurementPopoverBoundingRect, popoverSize, popoverRect, placementX, placementY, flippedPopoverRect;
|
|
192
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
193
|
+
while (1) switch (_context.prev = _context.next) {
|
|
246
194
|
case 0:
|
|
247
195
|
if (this._container) {
|
|
248
196
|
_context.next = 2;
|
|
249
197
|
break;
|
|
250
198
|
}
|
|
251
|
-
|
|
252
199
|
return _context.abrupt("return");
|
|
253
|
-
|
|
254
200
|
case 2:
|
|
255
201
|
anchor = this._anchor;
|
|
256
202
|
(0, _error_utils.invariant)(anchor instanceof Element, 'No anchor');
|
|
@@ -258,56 +204,45 @@ function (_React$Component) {
|
|
|
258
204
|
anchorRect = new Geometry.Rect(anchorBoundingClientRect.left, anchorBoundingClientRect.top, anchorBoundingClientRect.width, anchorBoundingClientRect.height);
|
|
259
205
|
viewportRect = new Geometry.Rect(0, 0, window.innerWidth, window.innerHeight); // Render the tooltip to measure its size. Render it to the right of the anchor element
|
|
260
206
|
// to start. Wait for the async render to complete before measuring. Otherwise, the
|
|
261
|
-
|
|
262
207
|
_context.next = 9;
|
|
263
|
-
return
|
|
264
|
-
|
|
208
|
+
return this._renderPopoverAtPositionAsync(anchorRect.right(), anchorRect.top());
|
|
265
209
|
case 9:
|
|
266
210
|
measurementPopover = this._popoverContent; // HACK(10/17/19): The measurementPopover is sometimes not set, possibly due to some race
|
|
267
211
|
// condition with the the popover being unmounted but we've been unable to identify the root
|
|
268
212
|
// cause. Calling this function again on the next frame works as a workaround. We plan to
|
|
269
213
|
// rebuild popover/tooltip in the new SDK without using ReactDOM.unstable_renderSubtreeIntoContainer,
|
|
270
214
|
// so this is hopefully just a temporary measure.
|
|
271
|
-
|
|
272
215
|
if (measurementPopover) {
|
|
273
216
|
_context.next = 13;
|
|
274
217
|
break;
|
|
275
218
|
}
|
|
276
|
-
|
|
277
219
|
requestAnimationFrame(this._refreshContainerAsync);
|
|
278
220
|
return _context.abrupt("return");
|
|
279
|
-
|
|
280
221
|
case 13:
|
|
281
222
|
measurementPopoverBoundingRect = measurementPopover.getBoundingClientRect();
|
|
282
223
|
popoverSize = new Geometry.Size(measurementPopoverBoundingRect.width, measurementPopoverBoundingRect.height);
|
|
283
224
|
popoverRect = this._getPlacedPopoverRect(popoverSize, anchorRect, this.props.placementX, this.props.placementY);
|
|
284
|
-
|
|
285
225
|
if (this.props.fitInWindowMode === FitInWindowModes.FLIP && !this._isRectContainedWithinViewportRect(popoverRect, viewportRect)) {
|
|
286
226
|
// Popover rect is outside the viewport rect, and fitInWindowMode is flip, so
|
|
287
227
|
// let's try flipping the popover.
|
|
288
228
|
placementX = this.props.placementX;
|
|
289
229
|
placementY = this.props.placementY;
|
|
290
|
-
|
|
291
230
|
if (popoverRect.left() < viewportRect.left()) {
|
|
292
231
|
placementX = PopoverPlacements.RIGHT;
|
|
293
232
|
} else if (popoverRect.right() > viewportRect.right()) {
|
|
294
233
|
placementX = PopoverPlacements.LEFT;
|
|
295
234
|
}
|
|
296
|
-
|
|
297
235
|
if (popoverRect.top() < viewportRect.top()) {
|
|
298
236
|
placementY = PopoverPlacements.BOTTOM;
|
|
299
237
|
} else if (popoverRect.bottom() > viewportRect.bottom()) {
|
|
300
238
|
placementY = PopoverPlacements.TOP;
|
|
301
239
|
}
|
|
302
|
-
|
|
303
240
|
flippedPopoverRect = this._getPlacedPopoverRect(popoverSize, anchorRect, placementX, placementY); // Check if the flipped rect is within the viewport before using it. If the flipped rect
|
|
304
241
|
// is also outside the viewport, we might as well just use the original one and then nudge it.
|
|
305
|
-
|
|
306
242
|
if (this._isRectContainedWithinViewportRect(flippedPopoverRect, viewportRect)) {
|
|
307
243
|
popoverRect = flippedPopoverRect;
|
|
308
244
|
}
|
|
309
245
|
}
|
|
310
|
-
|
|
311
246
|
if (this.props.fitInWindowMode !== FitInWindowModes.NONE) {
|
|
312
247
|
// Check again. If flipping didn't bring it inside viewport bounds,
|
|
313
248
|
// nudge it until it's within the viewport.
|
|
@@ -316,43 +251,39 @@ function (_React$Component) {
|
|
|
316
251
|
} else if (popoverRect.right() > viewportRect.right()) {
|
|
317
252
|
popoverRect = new Geometry.Rect(viewportRect.right() - popoverRect.width, popoverRect.y, popoverRect.width, popoverRect.height);
|
|
318
253
|
}
|
|
319
|
-
|
|
320
254
|
if (popoverRect.top() < viewportRect.top()) {
|
|
321
255
|
popoverRect = new Geometry.Rect(popoverRect.x, viewportRect.top(), popoverRect.width, popoverRect.height);
|
|
322
256
|
} else if (popoverRect.bottom() > viewportRect.bottom()) {
|
|
323
257
|
popoverRect = new Geometry.Rect(popoverRect.x, viewportRect.bottom() - popoverRect.height, popoverRect.width, popoverRect.height);
|
|
324
258
|
}
|
|
325
259
|
}
|
|
326
|
-
|
|
327
260
|
_context.next = 20;
|
|
328
|
-
return
|
|
329
|
-
|
|
261
|
+
return this._renderPopoverAtPositionAsync(popoverRect.left(), popoverRect.top());
|
|
330
262
|
case 20:
|
|
331
263
|
case "end":
|
|
332
264
|
return _context.stop();
|
|
333
265
|
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
266
|
+
}, _callee, this);
|
|
267
|
+
}));
|
|
268
|
+
function _refreshContainerAsync() {
|
|
269
|
+
return _refreshContainerAsync2.apply(this, arguments);
|
|
270
|
+
}
|
|
271
|
+
return _refreshContainerAsync;
|
|
272
|
+
}() /** @internal */)
|
|
339
273
|
}, {
|
|
340
274
|
key: "_isRectContainedWithinViewportRect",
|
|
341
275
|
value: function _isRectContainedWithinViewportRect(rect, viewportRect) {
|
|
342
276
|
if (rect.left() < viewportRect.left() || rect.right() > viewportRect.right() || rect.top() < viewportRect.top() || rect.bottom() > viewportRect.bottom()) {
|
|
343
277
|
return false;
|
|
344
278
|
}
|
|
345
|
-
|
|
346
279
|
return true;
|
|
347
280
|
}
|
|
348
281
|
/** @internal */
|
|
349
|
-
|
|
350
282
|
}, {
|
|
351
283
|
key: "_getPlacedPopoverRect",
|
|
352
284
|
value: function _getPlacedPopoverRect(popoverSize, anchorRect, placementX, placementY) {
|
|
353
285
|
var anchorCenterPoint = anchorRect.centerPoint();
|
|
354
286
|
var x;
|
|
355
|
-
|
|
356
287
|
if (placementX === PopoverPlacements.LEFT) {
|
|
357
288
|
x = anchorRect.left() - popoverSize.width - this.props.placementOffsetX;
|
|
358
289
|
} else if (placementX === PopoverPlacements.RIGHT) {
|
|
@@ -360,9 +291,7 @@ function (_React$Component) {
|
|
|
360
291
|
} else {
|
|
361
292
|
x = anchorCenterPoint.x - popoverSize.width / 2;
|
|
362
293
|
}
|
|
363
|
-
|
|
364
294
|
var y;
|
|
365
|
-
|
|
366
295
|
if (placementY === PopoverPlacements.TOP) {
|
|
367
296
|
y = anchorRect.top() - popoverSize.height - this.props.placementOffsetY;
|
|
368
297
|
} else if (placementY === PopoverPlacements.BOTTOM) {
|
|
@@ -370,23 +299,21 @@ function (_React$Component) {
|
|
|
370
299
|
} else {
|
|
371
300
|
y = anchorCenterPoint.y - popoverSize.height / 2;
|
|
372
301
|
}
|
|
373
|
-
|
|
374
302
|
return new Geometry.Rect(x, y, popoverSize.width, popoverSize.height);
|
|
375
303
|
}
|
|
376
304
|
/** @internal */
|
|
377
|
-
|
|
378
305
|
}, {
|
|
379
306
|
key: "_renderPopoverAtPositionAsync",
|
|
380
|
-
value: function
|
|
381
|
-
var
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
switch (_context2.prev = _context2.next) {
|
|
307
|
+
value: (function () {
|
|
308
|
+
var _renderPopoverAtPositionAsync2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(left, top) {
|
|
309
|
+
var content, backgroundClassName, backgroundStyle;
|
|
310
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
311
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
385
312
|
case 0:
|
|
386
313
|
content = this.props.renderContent();
|
|
387
|
-
content = React.cloneElement(content, {
|
|
314
|
+
content = /*#__PURE__*/React.cloneElement(content, {
|
|
388
315
|
ref: el => this._popoverContent = el,
|
|
389
|
-
style: _objectSpread({}, content.props.style, {
|
|
316
|
+
style: _objectSpread(_objectSpread({}, content.props.style), {}, {
|
|
390
317
|
position: 'absolute',
|
|
391
318
|
top,
|
|
392
319
|
left
|
|
@@ -396,11 +323,11 @@ function (_React$Component) {
|
|
|
396
323
|
backgroundStyle = this.props.backgroundStyle;
|
|
397
324
|
return _context2.abrupt("return", new Promise(resolve => {
|
|
398
325
|
var container = this._container;
|
|
399
|
-
(0, _error_utils.invariant)(container, 'container must exist');
|
|
326
|
+
(0, _error_utils.invariant)(container, 'container must exist');
|
|
327
|
+
// TODO(jb): we'll need to change this to support all versions of ReactDOM.
|
|
400
328
|
// Probably shouldn't be using unstable methods like this when we release the
|
|
401
329
|
// editor.
|
|
402
|
-
|
|
403
|
-
_reactDom.default.unstable_renderSubtreeIntoContainer(this, React.createElement("div", {
|
|
330
|
+
_reactDom.default.unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/React.createElement("div", {
|
|
404
331
|
ref: el => this._background = el,
|
|
405
332
|
className: backgroundClassName,
|
|
406
333
|
style: backgroundStyle,
|
|
@@ -408,16 +335,17 @@ function (_React$Component) {
|
|
|
408
335
|
onMouseUp: this._onMouseUp
|
|
409
336
|
}, content), container, resolve);
|
|
410
337
|
}));
|
|
411
|
-
|
|
412
338
|
case 5:
|
|
413
339
|
case "end":
|
|
414
340
|
return _context2.stop();
|
|
415
341
|
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
342
|
+
}, _callee2, this);
|
|
343
|
+
}));
|
|
344
|
+
function _renderPopoverAtPositionAsync(_x, _x2) {
|
|
345
|
+
return _renderPopoverAtPositionAsync2.apply(this, arguments);
|
|
346
|
+
}
|
|
347
|
+
return _renderPopoverAtPositionAsync;
|
|
348
|
+
}() /** @internal */)
|
|
421
349
|
}, {
|
|
422
350
|
key: "_onMouseDown",
|
|
423
351
|
value: function _onMouseDown(e) {
|
|
@@ -426,44 +354,34 @@ function (_React$Component) {
|
|
|
426
354
|
}
|
|
427
355
|
}
|
|
428
356
|
/** @internal */
|
|
429
|
-
|
|
430
357
|
}, {
|
|
431
358
|
key: "_onMouseUp",
|
|
432
359
|
value: function _onMouseUp(e) {
|
|
433
360
|
if (this._mouseDownOutsidePopover && this.props.onClose && this._shouldClickingOnElementClosePopover(e.target)) {
|
|
434
361
|
this.props.onClose();
|
|
435
362
|
}
|
|
436
|
-
|
|
437
363
|
this._mouseDownOutsidePopover = false;
|
|
438
364
|
}
|
|
439
365
|
/** @internal */
|
|
440
|
-
|
|
441
366
|
}, {
|
|
442
367
|
key: "_shouldClickingOnElementClosePopover",
|
|
443
368
|
value: function _shouldClickingOnElementClosePopover(element) {
|
|
444
369
|
return element === this._background;
|
|
445
370
|
}
|
|
446
371
|
/** @hidden */
|
|
447
|
-
|
|
448
372
|
}, {
|
|
449
373
|
key: "render",
|
|
450
374
|
value: function render() {
|
|
451
375
|
// TODO: if children is not a component (e.g. just string), wrap it in a div?
|
|
452
376
|
return this.props.children;
|
|
453
377
|
}
|
|
454
|
-
}, {
|
|
455
|
-
key: "_anchor",
|
|
456
|
-
get: function get() {
|
|
457
|
-
// TODO: use a ref
|
|
458
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
459
|
-
return _reactDom.default.findDOMNode(this);
|
|
460
|
-
}
|
|
461
378
|
}]);
|
|
462
|
-
return Popover;
|
|
463
379
|
}(React.Component);
|
|
464
|
-
|
|
380
|
+
/** @hidden */
|
|
465
381
|
(0, _defineProperty2.default)(Popover, "placements", PopoverPlacements);
|
|
382
|
+
/** @hidden */
|
|
466
383
|
(0, _defineProperty2.default)(Popover, "fitInWindowModes", FitInWindowModes);
|
|
384
|
+
/** @hidden */
|
|
467
385
|
(0, _defineProperty2.default)(Popover, "propTypes", {
|
|
468
386
|
children: _propTypes.default.element.isRequired,
|
|
469
387
|
renderContent: _propTypes.default.func.isRequired,
|
|
@@ -477,6 +395,7 @@ function (_React$Component) {
|
|
|
477
395
|
backgroundClassName: _propTypes.default.string,
|
|
478
396
|
backgroundStyle: _propTypes.default.object
|
|
479
397
|
});
|
|
398
|
+
/** @hidden */
|
|
480
399
|
(0, _defineProperty2.default)(Popover, "defaultProps", {
|
|
481
400
|
placementX: PopoverPlacements.CENTER,
|
|
482
401
|
placementY: PopoverPlacements.BOTTOM,
|
|
@@ -485,5 +404,4 @@ function (_React$Component) {
|
|
|
485
404
|
fitInWindowMode: FitInWindowModes.FLIP,
|
|
486
405
|
isOpen: true
|
|
487
406
|
});
|
|
488
|
-
var _default = Popover;
|
|
489
|
-
exports.default = _default;
|
|
407
|
+
var _default = exports.default = Popover;
|