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