@airtable/blocks 0.0.0-experimental-3e47d4d04-20250909 → 0.0.0-experimental-e625869e5-20251002
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/esm/base/types/airtable_interface.js +1 -3
- package/dist/esm/base/ui/block_wrapper.js +131 -96
- package/dist/esm/base/ui/cell_renderer.js +5 -176
- package/dist/esm/base/ui/global_alert.js +7 -3
- package/dist/esm/base/ui/global_css_helpers.js +28 -0
- package/dist/esm/base/ui/ui.js +1 -21
- package/dist/esm/base/ui/unstable_standalone_ui.js +28 -26
- package/dist/esm/base/ui/use_loadable.js +2 -3
- package/dist/esm/interface/types/airtable_interface.js +2 -3
- package/dist/esm/interface/ui/block_wrapper.js +45 -54
- package/dist/esm/interface/ui/cell_renderer.js +19 -0
- package/dist/esm/interface/ui/global_css_helpers.js +17 -0
- package/dist/esm/interface/ui/ui.js +1 -1
- package/dist/esm/interface/ui/use_custom_properties.js +43 -14
- package/dist/esm/shared/private_utils.js +51 -1
- package/dist/esm/shared/sdk_core.js +1 -1
- package/dist/esm/shared/ui/cell_renderer.js +137 -0
- package/dist/esm/shared/ui/use_watchable.js +2 -3
- package/dist/types/src/base/types/airtable_interface.d.ts +1 -3
- package/dist/types/src/base/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/base/ui/block_wrapper.d.ts +2 -16
- package/dist/types/src/base/ui/block_wrapper.d.ts.map +1 -1
- package/dist/types/src/base/ui/cell_renderer.d.ts +6 -58
- package/dist/types/src/base/ui/cell_renderer.d.ts.map +1 -1
- package/dist/types/src/base/ui/global_css_helpers.d.ts +4 -0
- package/dist/types/src/base/ui/global_css_helpers.d.ts.map +1 -0
- package/dist/types/src/base/ui/ui.d.ts +1 -21
- package/dist/types/src/base/ui/ui.d.ts.map +1 -1
- package/dist/types/src/base/ui/unstable_standalone_ui.d.ts +2 -22
- package/dist/types/src/base/ui/unstable_standalone_ui.d.ts.map +1 -1
- package/dist/types/src/base/ui/use_loadable.d.ts.map +1 -1
- package/dist/types/src/interface/types/airtable_interface.d.ts +6 -4
- package/dist/types/src/interface/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/interface/ui/block_wrapper.d.ts +1 -4
- package/dist/types/src/interface/ui/block_wrapper.d.ts.map +1 -1
- package/dist/types/src/interface/ui/cell_renderer.d.ts +19 -0
- package/dist/types/src/interface/ui/cell_renderer.d.ts.map +1 -0
- package/dist/types/src/interface/ui/global_css_helpers.d.ts +3 -0
- package/dist/types/src/interface/ui/global_css_helpers.d.ts.map +1 -0
- package/dist/types/src/interface/ui/ui.d.ts +1 -1
- package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
- package/dist/types/src/interface/ui/use_custom_properties.d.ts +7 -0
- package/dist/types/src/interface/ui/use_custom_properties.d.ts.map +1 -1
- package/dist/types/src/shared/private_utils.d.ts +9 -1
- package/dist/types/src/shared/private_utils.d.ts.map +1 -1
- package/dist/types/src/shared/ui/cell_renderer.d.ts +32 -0
- package/dist/types/src/shared/ui/cell_renderer.d.ts.map +1 -0
- package/dist/types/src/shared/ui/use_watchable.d.ts.map +1 -1
- package/package.json +5 -39
- package/dist/esm/base/ui/baymax_utils.js +0 -455
- package/dist/esm/base/ui/box.js +0 -77
- package/dist/esm/base/ui/button.js +0 -143
- package/dist/esm/base/ui/choice_token.js +0 -84
- package/dist/esm/base/ui/collaborator_token.js +0 -115
- package/dist/esm/base/ui/color_palette.js +0 -185
- package/dist/esm/base/ui/color_palette_synced.js +0 -62
- package/dist/esm/base/ui/confirmation_dialog.js +0 -96
- package/dist/esm/base/ui/control_sizes.js +0 -92
- package/dist/esm/base/ui/create_detect_element_resize.js +0 -197
- package/dist/esm/base/ui/css_helpers.js +0 -17
- package/dist/esm/base/ui/dialog.js +0 -93
- package/dist/esm/base/ui/dialog_close_button.js +0 -96
- package/dist/esm/base/ui/field_icon.js +0 -37
- package/dist/esm/base/ui/field_picker.js +0 -91
- package/dist/esm/base/ui/field_picker_synced.js +0 -59
- package/dist/esm/base/ui/form_field.js +0 -102
- package/dist/esm/base/ui/geometry/geometry.js +0 -9
- package/dist/esm/base/ui/geometry/point.js +0 -12
- package/dist/esm/base/ui/geometry/rect.js +0 -44
- package/dist/esm/base/ui/geometry/size.js +0 -12
- package/dist/esm/base/ui/heading.js +0 -125
- package/dist/esm/base/ui/icon.js +0 -102
- package/dist/esm/base/ui/icon_config.js +0 -423
- package/dist/esm/base/ui/input.js +0 -152
- package/dist/esm/base/ui/input_synced.js +0 -59
- package/dist/esm/base/ui/key_codes.js +0 -66
- package/dist/esm/base/ui/label.js +0 -73
- package/dist/esm/base/ui/link.js +0 -189
- package/dist/esm/base/ui/loader.js +0 -52
- package/dist/esm/base/ui/modal.js +0 -135
- package/dist/esm/base/ui/model_picker_select.js +0 -50
- package/dist/esm/base/ui/popover.js +0 -312
- package/dist/esm/base/ui/progress_bar.js +0 -106
- package/dist/esm/base/ui/record_card.js +0 -556
- package/dist/esm/base/ui/record_card_list.js +0 -292
- package/dist/esm/base/ui/select.js +0 -182
- package/dist/esm/base/ui/select_and_select_buttons_helpers.js +0 -53
- package/dist/esm/base/ui/select_buttons.js +0 -150
- package/dist/esm/base/ui/select_buttons_synced.js +0 -55
- package/dist/esm/base/ui/select_synced.js +0 -58
- package/dist/esm/base/ui/switch.js +0 -160
- package/dist/esm/base/ui/switch_synced.js +0 -46
- package/dist/esm/base/ui/synced.js +0 -39
- package/dist/esm/base/ui/system/all_styles_set.js +0 -86
- package/dist/esm/base/ui/system/appearance/appearance_set.js +0 -21
- package/dist/esm/base/ui/system/appearance/background_color.js +0 -12
- package/dist/esm/base/ui/system/appearance/border.js +0 -48
- package/dist/esm/base/ui/system/appearance/border_radius.js +0 -12
- package/dist/esm/base/ui/system/appearance/box_shadow.js +0 -12
- package/dist/esm/base/ui/system/appearance/opacity.js +0 -12
- package/dist/esm/base/ui/system/dimensions/dimensions_set.js +0 -23
- package/dist/esm/base/ui/system/dimensions/height.js +0 -12
- package/dist/esm/base/ui/system/dimensions/max_height.js +0 -12
- package/dist/esm/base/ui/system/dimensions/max_width.js +0 -12
- package/dist/esm/base/ui/system/dimensions/min_height.js +0 -12
- package/dist/esm/base/ui/system/dimensions/min_width.js +0 -12
- package/dist/esm/base/ui/system/dimensions/width.js +0 -12
- package/dist/esm/base/ui/system/display.js +0 -13
- package/dist/esm/base/ui/system/flex_container/align_content.js +0 -9
- package/dist/esm/base/ui/system/flex_container/align_items.js +0 -9
- package/dist/esm/base/ui/system/flex_container/flex_container_set.js +0 -23
- package/dist/esm/base/ui/system/flex_container/flex_direction.js +0 -9
- package/dist/esm/base/ui/system/flex_container/flex_wrap.js +0 -9
- package/dist/esm/base/ui/system/flex_container/justify_content.js +0 -9
- package/dist/esm/base/ui/system/flex_container/justify_items.js +0 -10
- package/dist/esm/base/ui/system/flex_item/align_self.js +0 -9
- package/dist/esm/base/ui/system/flex_item/flex.js +0 -9
- package/dist/esm/base/ui/system/flex_item/flex_basis.js +0 -9
- package/dist/esm/base/ui/system/flex_item/flex_grow.js +0 -9
- package/dist/esm/base/ui/system/flex_item/flex_item_set.js +0 -25
- package/dist/esm/base/ui/system/flex_item/flex_shrink.js +0 -9
- package/dist/esm/base/ui/system/flex_item/justify_self.js +0 -10
- package/dist/esm/base/ui/system/flex_item/order.js +0 -9
- package/dist/esm/base/ui/system/index.js +0 -96
- package/dist/esm/base/ui/system/overflow.js +0 -15
- package/dist/esm/base/ui/system/position/bottom.js +0 -17
- package/dist/esm/base/ui/system/position/left.js +0 -17
- package/dist/esm/base/ui/system/position/position.js +0 -9
- package/dist/esm/base/ui/system/position/position_set.js +0 -23
- package/dist/esm/base/ui/system/position/right.js +0 -17
- package/dist/esm/base/ui/system/position/top.js +0 -17
- package/dist/esm/base/ui/system/position/z_index.js +0 -12
- package/dist/esm/base/ui/system/spacing/margin.js +0 -65
- package/dist/esm/base/ui/system/spacing/padding.js +0 -58
- package/dist/esm/base/ui/system/spacing/spacing_set.js +0 -15
- package/dist/esm/base/ui/system/typography/font_family.js +0 -12
- package/dist/esm/base/ui/system/typography/font_size.js +0 -12
- package/dist/esm/base/ui/system/typography/font_style.js +0 -9
- package/dist/esm/base/ui/system/typography/font_weight.js +0 -12
- package/dist/esm/base/ui/system/typography/letter_spacing.js +0 -12
- package/dist/esm/base/ui/system/typography/line_height.js +0 -9
- package/dist/esm/base/ui/system/typography/text_align.js +0 -9
- package/dist/esm/base/ui/system/typography/text_color.js +0 -12
- package/dist/esm/base/ui/system/typography/text_decoration.js +0 -9
- package/dist/esm/base/ui/system/typography/text_transform.js +0 -9
- package/dist/esm/base/ui/system/typography/typography_set.js +0 -31
- package/dist/esm/base/ui/system/utils/csstype.js +0 -1
- package/dist/esm/base/ui/system/utils/ensure_numbers_are_within_scale.js +0 -36
- package/dist/esm/base/ui/system/utils/get_style_props_for_responsive_prop.js +0 -67
- package/dist/esm/base/ui/system/utils/types.js +0 -1
- package/dist/esm/base/ui/table_picker.js +0 -64
- package/dist/esm/base/ui/table_picker_synced.js +0 -55
- package/dist/esm/base/ui/text.js +0 -109
- package/dist/esm/base/ui/text_button.js +0 -189
- package/dist/esm/base/ui/theme/default_theme/button_variants.js +0 -53
- package/dist/esm/base/ui/theme/default_theme/control_sizes.js +0 -96
- package/dist/esm/base/ui/theme/default_theme/heading_styles.js +0 -93
- package/dist/esm/base/ui/theme/default_theme/index.js +0 -31
- package/dist/esm/base/ui/theme/default_theme/input_variants.js +0 -32
- package/dist/esm/base/ui/theme/default_theme/link_variants.js +0 -29
- package/dist/esm/base/ui/theme/default_theme/select_buttons_variants.js +0 -66
- package/dist/esm/base/ui/theme/default_theme/select_variants.js +0 -44
- package/dist/esm/base/ui/theme/default_theme/switch_variants.js +0 -78
- package/dist/esm/base/ui/theme/default_theme/text_button_variants.js +0 -38
- package/dist/esm/base/ui/theme/default_theme/text_styles.js +0 -75
- package/dist/esm/base/ui/theme/default_theme/tokens.js +0 -205
- package/dist/esm/base/ui/theme/theme_context.js +0 -7
- package/dist/esm/base/ui/theme/use_theme.js +0 -4
- package/dist/esm/base/ui/tooltip.js +0 -165
- package/dist/esm/base/ui/types/aria_props.js +0 -1
- package/dist/esm/base/ui/types/data_attributes_prop.js +0 -1
- package/dist/esm/base/ui/types/tooltip_anchor_props.js +0 -1
- package/dist/esm/base/ui/use_form_field.js +0 -14
- package/dist/esm/base/ui/use_styled_system.js +0 -19
- package/dist/esm/base/ui/use_text_color_for_background_color.js +0 -9
- package/dist/esm/base/ui/view_picker.js +0 -82
- package/dist/esm/base/ui/view_picker_synced.js +0 -59
- package/dist/esm/base/ui/viewport_constraint.js +0 -120
- package/dist/esm/base/ui/with_styled_system.js +0 -120
- package/dist/types/src/base/ui/baymax_utils.d.ts +0 -2
- package/dist/types/src/base/ui/baymax_utils.d.ts.map +0 -1
- package/dist/types/src/base/ui/box.d.ts +0 -35
- package/dist/types/src/base/ui/box.d.ts.map +0 -1
- package/dist/types/src/base/ui/button.d.ts +0 -86
- package/dist/types/src/base/ui/button.d.ts.map +0 -1
- package/dist/types/src/base/ui/choice_token.d.ts +0 -49
- package/dist/types/src/base/ui/choice_token.d.ts.map +0 -1
- package/dist/types/src/base/ui/collaborator_token.d.ts +0 -45
- package/dist/types/src/base/ui/collaborator_token.d.ts.map +0 -1
- package/dist/types/src/base/ui/color_palette.d.ts +0 -77
- package/dist/types/src/base/ui/color_palette.d.ts.map +0 -1
- package/dist/types/src/base/ui/color_palette_synced.d.ts +0 -30
- package/dist/types/src/base/ui/color_palette_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/confirmation_dialog.d.ts +0 -66
- package/dist/types/src/base/ui/confirmation_dialog.d.ts.map +0 -1
- package/dist/types/src/base/ui/control_sizes.d.ts +0 -16
- package/dist/types/src/base/ui/control_sizes.d.ts.map +0 -1
- package/dist/types/src/base/ui/css_helpers.d.ts +0 -6
- package/dist/types/src/base/ui/css_helpers.d.ts.map +0 -1
- package/dist/types/src/base/ui/dialog.d.ts +0 -58
- package/dist/types/src/base/ui/dialog.d.ts.map +0 -1
- package/dist/types/src/base/ui/dialog_close_button.d.ts +0 -40
- package/dist/types/src/base/ui/dialog_close_button.d.ts.map +0 -1
- package/dist/types/src/base/ui/field_icon.d.ts +0 -25
- package/dist/types/src/base/ui/field_icon.d.ts.map +0 -1
- package/dist/types/src/base/ui/field_picker.d.ts +0 -34
- package/dist/types/src/base/ui/field_picker.d.ts.map +0 -1
- package/dist/types/src/base/ui/field_picker_synced.d.ts +0 -18
- package/dist/types/src/base/ui/field_picker_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/form_field.d.ts +0 -42
- package/dist/types/src/base/ui/form_field.d.ts.map +0 -1
- package/dist/types/src/base/ui/geometry/geometry.d.ts +0 -3
- package/dist/types/src/base/ui/geometry/geometry.d.ts.map +0 -1
- package/dist/types/src/base/ui/geometry/point.d.ts +0 -2
- package/dist/types/src/base/ui/geometry/point.d.ts.map +0 -1
- package/dist/types/src/base/ui/geometry/rect.d.ts +0 -2
- package/dist/types/src/base/ui/geometry/rect.d.ts.map +0 -1
- package/dist/types/src/base/ui/geometry/size.d.ts +0 -2
- package/dist/types/src/base/ui/geometry/size.d.ts.map +0 -1
- package/dist/types/src/base/ui/heading.d.ts +0 -64
- package/dist/types/src/base/ui/heading.d.ts.map +0 -1
- package/dist/types/src/base/ui/icon.d.ts +0 -45
- package/dist/types/src/base/ui/icon.d.ts.map +0 -1
- package/dist/types/src/base/ui/icon_config.d.ts +0 -424
- package/dist/types/src/base/ui/icon_config.d.ts.map +0 -1
- package/dist/types/src/base/ui/input.d.ts +0 -120
- package/dist/types/src/base/ui/input.d.ts.map +0 -1
- package/dist/types/src/base/ui/input_synced.d.ts +0 -18
- package/dist/types/src/base/ui/input_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/key_codes.d.ts +0 -2
- package/dist/types/src/base/ui/key_codes.d.ts.map +0 -1
- package/dist/types/src/base/ui/label.d.ts +0 -35
- package/dist/types/src/base/ui/label.d.ts.map +0 -1
- package/dist/types/src/base/ui/link.d.ts +0 -84
- package/dist/types/src/base/ui/link.d.ts.map +0 -1
- package/dist/types/src/base/ui/loader.d.ts +0 -38
- package/dist/types/src/base/ui/loader.d.ts.map +0 -1
- package/dist/types/src/base/ui/modal.d.ts +0 -54
- package/dist/types/src/base/ui/modal.d.ts.map +0 -1
- package/dist/types/src/base/ui/model_picker_select.d.ts +0 -19
- package/dist/types/src/base/ui/model_picker_select.d.ts.map +0 -1
- package/dist/types/src/base/ui/popover.d.ts +0 -106
- package/dist/types/src/base/ui/popover.d.ts.map +0 -1
- package/dist/types/src/base/ui/progress_bar.d.ts +0 -60
- package/dist/types/src/base/ui/progress_bar.d.ts.map +0 -1
- package/dist/types/src/base/ui/record_card.d.ts +0 -80
- package/dist/types/src/base/ui/record_card.d.ts.map +0 -1
- package/dist/types/src/base/ui/record_card_list.d.ts +0 -88
- package/dist/types/src/base/ui/record_card_list.d.ts.map +0 -1
- package/dist/types/src/base/ui/select.d.ts +0 -82
- package/dist/types/src/base/ui/select.d.ts.map +0 -1
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts +0 -25
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +0 -1
- package/dist/types/src/base/ui/select_buttons.d.ts +0 -56
- package/dist/types/src/base/ui/select_buttons.d.ts.map +0 -1
- package/dist/types/src/base/ui/select_buttons_synced.d.ts +0 -18
- package/dist/types/src/base/ui/select_buttons_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/select_synced.d.ts +0 -18
- package/dist/types/src/base/ui/select_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/switch.d.ts +0 -82
- package/dist/types/src/base/ui/switch.d.ts.map +0 -1
- package/dist/types/src/base/ui/switch_synced.d.ts +0 -18
- package/dist/types/src/base/ui/switch_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/synced.d.ts +0 -23
- package/dist/types/src/base/ui/synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/all_styles_set.d.ts +0 -85
- package/dist/types/src/base/ui/system/all_styles_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts +0 -14
- package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/background_color.d.ts +0 -12
- package/dist/types/src/base/ui/system/appearance/background_color.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/border.d.ts +0 -30
- package/dist/types/src/base/ui/system/appearance/border.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/border_radius.d.ts +0 -12
- package/dist/types/src/base/ui/system/appearance/border_radius.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts +0 -12
- package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/appearance/opacity.d.ts +0 -12
- package/dist/types/src/base/ui/system/appearance/opacity.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts +0 -15
- package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/height.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/height.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/max_height.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/max_height.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/max_width.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/max_width.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/min_height.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/min_height.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/min_width.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/min_width.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/dimensions/width.d.ts +0 -12
- package/dist/types/src/base/ui/system/dimensions/width.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/display.d.ts +0 -13
- package/dist/types/src/base/ui/system/display.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/align_content.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/align_content.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/align_items.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/align_items.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts +0 -15
- package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/align_self.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/align_self.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/flex.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts +0 -16
- package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/flex_item/order.d.ts +0 -12
- package/dist/types/src/base/ui/system/flex_item/order.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/index.d.ts +0 -106
- package/dist/types/src/base/ui/system/index.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/overflow.d.ts +0 -17
- package/dist/types/src/base/ui/system/overflow.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/bottom.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/bottom.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/left.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/left.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/position.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/position.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/position_set.d.ts +0 -15
- package/dist/types/src/base/ui/system/position/position_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/right.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/right.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/top.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/top.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/position/z_index.d.ts +0 -12
- package/dist/types/src/base/ui/system/position/z_index.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/spacing/margin.d.ts +0 -24
- package/dist/types/src/base/ui/system/spacing/margin.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/spacing/padding.d.ts +0 -24
- package/dist/types/src/base/ui/system/spacing/padding.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts +0 -11
- package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/font_family.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/font_family.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/font_size.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/font_size.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/font_style.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/font_style.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/font_weight.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/font_weight.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/line_height.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/line_height.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/text_align.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/text_align.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/text_color.d.ts +0 -16
- package/dist/types/src/base/ui/system/typography/text_color.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/text_decoration.d.ts +0 -14
- package/dist/types/src/base/ui/system/typography/text_decoration.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/text_transform.d.ts +0 -12
- package/dist/types/src/base/ui/system/typography/text_transform.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/typography/typography_set.d.ts +0 -19
- package/dist/types/src/base/ui/system/typography/typography_set.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/csstype.d.ts +0 -3977
- package/dist/types/src/base/ui/system/utils/csstype.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/ensure_numbers_are_within_scale.d.ts +0 -2
- package/dist/types/src/base/ui/system/utils/ensure_numbers_are_within_scale.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/get_style_props_for_responsive_prop.d.ts +0 -2
- package/dist/types/src/base/ui/system/utils/get_style_props_for_responsive_prop.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/types.d.ts +0 -31
- package/dist/types/src/base/ui/system/utils/types.d.ts.map +0 -1
- package/dist/types/src/base/ui/table_picker.d.ts +0 -28
- package/dist/types/src/base/ui/table_picker.d.ts.map +0 -1
- package/dist/types/src/base/ui/table_picker_synced.d.ts +0 -18
- package/dist/types/src/base/ui/table_picker_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/text.d.ts +0 -66
- package/dist/types/src/base/ui/text.d.ts.map +0 -1
- package/dist/types/src/base/ui/text_button.d.ts +0 -83
- package/dist/types/src/base/ui/text_button.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/button_variants.d.ts +0 -8
- package/dist/types/src/base/ui/theme/default_theme/button_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/control_sizes.d.ts +0 -107
- package/dist/types/src/base/ui/theme/default_theme/control_sizes.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/heading_styles.d.ts +0 -11
- package/dist/types/src/base/ui/theme/default_theme/heading_styles.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/index.d.ts +0 -342
- package/dist/types/src/base/ui/theme/default_theme/index.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/input_variants.d.ts +0 -5
- package/dist/types/src/base/ui/theme/default_theme/input_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/link_variants.d.ts +0 -7
- package/dist/types/src/base/ui/theme/default_theme/link_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/select_buttons_variants.d.ts +0 -8
- package/dist/types/src/base/ui/theme/default_theme/select_buttons_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/select_variants.d.ts +0 -5
- package/dist/types/src/base/ui/theme/default_theme/select_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/switch_variants.d.ts +0 -16
- package/dist/types/src/base/ui/theme/default_theme/switch_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/text_button_variants.d.ts +0 -7
- package/dist/types/src/base/ui/theme/default_theme/text_button_variants.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/text_styles.d.ts +0 -76
- package/dist/types/src/base/ui/theme/default_theme/text_styles.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/default_theme/tokens.d.ts +0 -111
- package/dist/types/src/base/ui/theme/default_theme/tokens.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/theme_context.d.ts +0 -342
- package/dist/types/src/base/ui/theme/theme_context.d.ts.map +0 -1
- package/dist/types/src/base/ui/theme/use_theme.d.ts +0 -342
- package/dist/types/src/base/ui/theme/use_theme.d.ts.map +0 -1
- package/dist/types/src/base/ui/tooltip.d.ts +0 -64
- package/dist/types/src/base/ui/tooltip.d.ts.map +0 -1
- package/dist/types/src/base/ui/types/aria_props.d.ts +0 -22
- package/dist/types/src/base/ui/types/aria_props.d.ts.map +0 -1
- package/dist/types/src/base/ui/types/data_attributes_prop.d.ts +0 -10
- package/dist/types/src/base/ui/types/data_attributes_prop.d.ts.map +0 -1
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +0 -13
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +0 -1
- package/dist/types/src/base/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/base/ui/use_form_field.d.ts.map +0 -1
- package/dist/types/src/base/ui/use_styled_system.d.ts +0 -2
- package/dist/types/src/base/ui/use_styled_system.d.ts.map +0 -1
- package/dist/types/src/base/ui/use_text_color_for_background_color.d.ts +0 -2
- package/dist/types/src/base/ui/use_text_color_for_background_color.d.ts.map +0 -1
- package/dist/types/src/base/ui/view_picker.d.ts +0 -34
- package/dist/types/src/base/ui/view_picker.d.ts.map +0 -1
- package/dist/types/src/base/ui/view_picker_synced.d.ts +0 -18
- package/dist/types/src/base/ui/view_picker_synced.d.ts.map +0 -1
- package/dist/types/src/base/ui/viewport_constraint.d.ts +0 -57
- package/dist/types/src/base/ui/viewport_constraint.d.ts.map +0 -1
- package/dist/types/src/base/ui/with_styled_system.d.ts +0 -2
- package/dist/types/src/base/ui/with_styled_system.d.ts.map +0 -1
- package/types/styled-system__core.d.ts +0 -41
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/** @hidden */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import { compose } from '@styled-system/core';
|
|
6
|
-
import { invariant } from '../../shared/error_utils';
|
|
7
|
-
import { baymax } from './baymax_utils';
|
|
8
|
-
import withStyledSystem from './with_styled_system';
|
|
9
|
-
import { dimensionsSet, display, flexContainerSet, spacingSet } from './system';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Props for the {@link Modal} component. Also accepts:
|
|
13
|
-
* * {@link ModalStyleProps}
|
|
14
|
-
*
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
// This doesn't actually extend ModalStyleProps since withStyledSystem
|
|
18
|
-
// expects non-style props and style props as separate generic type variables.
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Style props shared between the {@link Modal}, {@link Dialog}, and {@link ConfirmationDialog} components. Also accepts:
|
|
22
|
-
* * {@link DimensionsSetProps}
|
|
23
|
-
* * {@link FlexContainerSetProps}
|
|
24
|
-
* * {@link SpacingSetProps}
|
|
25
|
-
*
|
|
26
|
-
* @hidden
|
|
27
|
-
* @noInheritDoc
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const styleParser = compose(dimensionsSet, display, flexContainerSet, spacingSet);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Generic modal component with minimal styling.
|
|
34
|
-
*
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
// TODO (stephen): refactor so Modal only includes the background element and renders the dialog via children
|
|
38
|
-
export class Modal extends React.Component {
|
|
39
|
-
/** @internal */
|
|
40
|
-
|
|
41
|
-
/** @internal */
|
|
42
|
-
|
|
43
|
-
/** @internal */
|
|
44
|
-
|
|
45
|
-
/** @internal */
|
|
46
|
-
|
|
47
|
-
/** @hidden */
|
|
48
|
-
constructor(props) {
|
|
49
|
-
super(props);
|
|
50
|
-
this._background = null;
|
|
51
|
-
this._container = document.createElement('div');
|
|
52
|
-
this._originalActiveElement = null;
|
|
53
|
-
this._mouseDownOutsideModal = false;
|
|
54
|
-
this._onMouseDown = this._onMouseDown.bind(this);
|
|
55
|
-
this._onMouseUp = this._onMouseUp.bind(this);
|
|
56
|
-
}
|
|
57
|
-
/** @hidden */
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
const container = this._container;
|
|
60
|
-
container.setAttribute('tabIndex', '0');
|
|
61
|
-
container.style.zIndex = '99999';
|
|
62
|
-
// If we don't set `position: fixed`, the outline and box-shadow
|
|
63
|
-
// of elements that are in theory underneath this element will cover
|
|
64
|
-
// up the modal.
|
|
65
|
-
container.style.position = 'fixed';
|
|
66
|
-
invariant(document.body, 'no document body');
|
|
67
|
-
document.body.appendChild(container);
|
|
68
|
-
|
|
69
|
-
// If the frame is focused, move focus to the modal's container.
|
|
70
|
-
// Next time the user presses tab, it will focus the first focusable element in the modal.
|
|
71
|
-
// We only do this if the document is focused to avoid the frame becoming
|
|
72
|
-
// programmatically focused if a modal is displayed without user interaction.
|
|
73
|
-
if (document.hasFocus()) {
|
|
74
|
-
this._originalActiveElement = document.activeElement;
|
|
75
|
-
container.focus();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/** @hidden */
|
|
79
|
-
componentWillUnmount() {
|
|
80
|
-
invariant(document.body, 'no document body');
|
|
81
|
-
document.body.removeChild(this._container);
|
|
82
|
-
if (this._originalActiveElement !== null) {
|
|
83
|
-
this._originalActiveElement.focus();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/** @internal */
|
|
87
|
-
_onMouseDown(e) {
|
|
88
|
-
if (this._shouldClickingOnElementCloseModal(e.target)) {
|
|
89
|
-
this._mouseDownOutsideModal = true;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/** @internal */
|
|
93
|
-
_onMouseUp(e) {
|
|
94
|
-
if (this._mouseDownOutsideModal && this.props.onClose && this._shouldClickingOnElementCloseModal(e.target)) {
|
|
95
|
-
this.props.onClose();
|
|
96
|
-
}
|
|
97
|
-
this._mouseDownOutsideModal = false;
|
|
98
|
-
}
|
|
99
|
-
/** @internal */
|
|
100
|
-
_shouldClickingOnElementCloseModal(el) {
|
|
101
|
-
return el === this._background;
|
|
102
|
-
}
|
|
103
|
-
/** @hidden */
|
|
104
|
-
render() {
|
|
105
|
-
const {
|
|
106
|
-
className,
|
|
107
|
-
style,
|
|
108
|
-
backgroundClassName,
|
|
109
|
-
backgroundStyle,
|
|
110
|
-
children
|
|
111
|
-
} = this.props;
|
|
112
|
-
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
|
|
113
|
-
ref: el => {
|
|
114
|
-
this._background = el;
|
|
115
|
-
},
|
|
116
|
-
className: cx(baymax('fixed all-0 darken3 flex items-center justify-center'), backgroundClassName),
|
|
117
|
-
style: backgroundStyle,
|
|
118
|
-
onMouseDown: this._onMouseDown,
|
|
119
|
-
onMouseUp: this._onMouseUp
|
|
120
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
121
|
-
className: cx(baymax('relative overflow-auto light-scrollbar white stroked1 rounded-big animate-bounce-in'), className),
|
|
122
|
-
style: style
|
|
123
|
-
}, children)), this._container);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export default withStyledSystem(Modal, styleParser,
|
|
127
|
-
// TODO (stephen): move these to Dialog
|
|
128
|
-
{
|
|
129
|
-
display: 'block',
|
|
130
|
-
width: '100%',
|
|
131
|
-
maxWidth: '100vw',
|
|
132
|
-
maxHeight: '100vh',
|
|
133
|
-
margin: 3,
|
|
134
|
-
padding: 3
|
|
135
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
/** @hidden */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { invariant } from '../../shared/error_utils';
|
|
5
|
-
import useWatchable from '../../shared/ui/use_watchable';
|
|
6
|
-
import Select from './select';
|
|
7
|
-
|
|
8
|
-
// Private component used by TablePicker, ViewPicker, FieldPicker.
|
|
9
|
-
|
|
10
|
-
function ModelPickerSelect(props, ref) {
|
|
11
|
-
const {
|
|
12
|
-
models,
|
|
13
|
-
modelKeysToWatch,
|
|
14
|
-
selectedModelId,
|
|
15
|
-
shouldAllowPickingNone,
|
|
16
|
-
shouldAllowPickingModelFn,
|
|
17
|
-
placeholder,
|
|
18
|
-
// Destructure `onChange` to prevent it from being passed to `Select`.
|
|
19
|
-
onChange,
|
|
20
|
-
...restOfProps
|
|
21
|
-
} = props;
|
|
22
|
-
|
|
23
|
-
// useWatchable has stricter typing than createDataContainer which it replaced, so we can't
|
|
24
|
-
// know that model and modelKeysToWatch are exactly compatible here:
|
|
25
|
-
useWatchable(models, modelKeysToWatch);
|
|
26
|
-
function _onChange(value) {
|
|
27
|
-
invariant(value === null || typeof value === 'string', 'value must be null or model id');
|
|
28
|
-
onChange(value);
|
|
29
|
-
}
|
|
30
|
-
const options = [{
|
|
31
|
-
value: null,
|
|
32
|
-
label: placeholder,
|
|
33
|
-
disabled: !shouldAllowPickingNone
|
|
34
|
-
}, ...models.map(model => {
|
|
35
|
-
return {
|
|
36
|
-
value: model.id,
|
|
37
|
-
label: model.name,
|
|
38
|
-
disabled: shouldAllowPickingModelFn && !shouldAllowPickingModelFn(model)
|
|
39
|
-
};
|
|
40
|
-
})];
|
|
41
|
-
return /*#__PURE__*/React.createElement(Select, _extends({}, restOfProps, {
|
|
42
|
-
ref: ref,
|
|
43
|
-
value: selectedModelId,
|
|
44
|
-
onChange: _onChange,
|
|
45
|
-
options: options
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
const ForwardedRefModelPickerSelect = /*#__PURE__*/React.forwardRef(ModelPickerSelect);
|
|
49
|
-
ForwardedRefModelPickerSelect.displayName = 'ModelPickerSelect';
|
|
50
|
-
export default ForwardedRefModelPickerSelect;
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: Popover */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import { createRoot } from 'react-dom/client';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { invariant } from '../../shared/error_utils';
|
|
6
|
-
import { baymax } from './baymax_utils';
|
|
7
|
-
import createDetectElementResize from './create_detect_element_resize';
|
|
8
|
-
import * as Geometry from './geometry/geometry';
|
|
9
|
-
|
|
10
|
-
// NOTE(evanhahn) I wasn't figure out a better way to document these enums
|
|
11
|
-
// with JSDoc. The @memberof directive doesn't seem to work when the token
|
|
12
|
-
// contains a period (as Popover.placements does).
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Dictates how a {@link Tooltip} component should be positioned relative
|
|
16
|
-
* to the anchor element. Accessed via `Tooltip.placements`.
|
|
17
|
-
*/
|
|
18
|
-
// TODO (stephen): convert to createEnum
|
|
19
|
-
export let PopoverPlacements = /*#__PURE__*/function (PopoverPlacements) {
|
|
20
|
-
PopoverPlacements["TOP"] = "top";
|
|
21
|
-
PopoverPlacements["BOTTOM"] = "bottom";
|
|
22
|
-
PopoverPlacements["CENTER"] = "center";
|
|
23
|
-
PopoverPlacements["LEFT"] = "left";
|
|
24
|
-
PopoverPlacements["RIGHT"] = "right";
|
|
25
|
-
return PopoverPlacements;
|
|
26
|
-
}({});
|
|
27
|
-
/**
|
|
28
|
-
* Any of the supported {@link PopoverPlacements} for horizontal positioning.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Any of the supported {@link PopoverPlacements} for vertical positioning.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Dictates how a {@link Popover} or {@link Tooltip} component should be kept within the viewport. Accessed via `Popover.fitInWindowModes` or `Tooltip.fitInWindowModes`.
|
|
37
|
-
*/
|
|
38
|
-
// TODO (stephen): convert to createEnum
|
|
39
|
-
export let FitInWindowModes = /*#__PURE__*/function (FitInWindowModes) {
|
|
40
|
-
FitInWindowModes["NONE"] = "none";
|
|
41
|
-
FitInWindowModes["FLIP"] = "flip";
|
|
42
|
-
FitInWindowModes["NUDGE"] = "nudge";
|
|
43
|
-
return FitInWindowModes;
|
|
44
|
-
}({});
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Any of the supported {@link FitInWindowModes}.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Props for the {@link Popover} component.
|
|
52
|
-
*
|
|
53
|
-
* @hidden
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A popover component, which is used to "float" some content above some other content.
|
|
58
|
-
*
|
|
59
|
-
* @hidden
|
|
60
|
-
* @docsPath UI/components/Popover
|
|
61
|
-
* @component
|
|
62
|
-
*/
|
|
63
|
-
class Popover extends React.Component {
|
|
64
|
-
/** @hidden */
|
|
65
|
-
static placements = PopoverPlacements;
|
|
66
|
-
/** @hidden */
|
|
67
|
-
static fitInWindowModes = FitInWindowModes;
|
|
68
|
-
|
|
69
|
-
/** @hidden */
|
|
70
|
-
static defaultProps = {
|
|
71
|
-
placementX: PopoverPlacements.CENTER,
|
|
72
|
-
placementY: PopoverPlacements.BOTTOM,
|
|
73
|
-
placementOffsetX: 0,
|
|
74
|
-
placementOffsetY: 0,
|
|
75
|
-
fitInWindowMode: FitInWindowModes.FLIP,
|
|
76
|
-
isOpen: true
|
|
77
|
-
};
|
|
78
|
-
/** @internal */
|
|
79
|
-
|
|
80
|
-
/** @internal */
|
|
81
|
-
|
|
82
|
-
/** @internal */
|
|
83
|
-
|
|
84
|
-
/** @internal */
|
|
85
|
-
|
|
86
|
-
/** @internal */
|
|
87
|
-
|
|
88
|
-
/** @internal */
|
|
89
|
-
|
|
90
|
-
/** @internal */
|
|
91
|
-
|
|
92
|
-
/** @hidden */
|
|
93
|
-
constructor(props) {
|
|
94
|
-
super(props);
|
|
95
|
-
this._reactRoot = null;
|
|
96
|
-
this._container = null;
|
|
97
|
-
this._anchor = null;
|
|
98
|
-
this._background = null;
|
|
99
|
-
this._popoverContent = null;
|
|
100
|
-
this._mouseDownOutsidePopover = false;
|
|
101
|
-
this._onMouseDown = this._onMouseDown.bind(this);
|
|
102
|
-
this._onMouseUp = this._onMouseUp.bind(this);
|
|
103
|
-
this._refreshContainerAsync = this._refreshContainerAsync.bind(this);
|
|
104
|
-
}
|
|
105
|
-
/** @hidden */
|
|
106
|
-
componentDidMount() {
|
|
107
|
-
if (this.props.isOpen) {
|
|
108
|
-
this._createContainer();
|
|
109
|
-
}
|
|
110
|
-
this._refreshContainerAsync();
|
|
111
|
-
}
|
|
112
|
-
/** @hidden */
|
|
113
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
114
|
-
if (nextProps.isOpen) {
|
|
115
|
-
this._createContainer();
|
|
116
|
-
} else {
|
|
117
|
-
this._destroyContainer();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/** @hidden */
|
|
121
|
-
componentDidUpdate() {
|
|
122
|
-
this._refreshContainerAsync();
|
|
123
|
-
}
|
|
124
|
-
/** @hidden */
|
|
125
|
-
componentWillUnmount() {
|
|
126
|
-
this._destroyContainer();
|
|
127
|
-
}
|
|
128
|
-
/** @internal */
|
|
129
|
-
_createContainer() {
|
|
130
|
-
if (this._container) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this._container = document.createElement('div');
|
|
134
|
-
const container = this._container;
|
|
135
|
-
container.setAttribute('tabIndex', '0');
|
|
136
|
-
container.style.zIndex = '99999';
|
|
137
|
-
container.style.position = 'relative';
|
|
138
|
-
invariant(document.body, 'no document body');
|
|
139
|
-
document.body.appendChild(container);
|
|
140
|
-
this._reactRoot = createRoot(container);
|
|
141
|
-
window.addEventListener('scroll', this._refreshContainerAsync);
|
|
142
|
-
this._detectElementResize = createDetectElementResize();
|
|
143
|
-
this._detectElementResize.addResizeListener(this._anchor, this._refreshContainerAsync);
|
|
144
|
-
}
|
|
145
|
-
/** @internal */
|
|
146
|
-
_destroyContainer() {
|
|
147
|
-
const container = this._container;
|
|
148
|
-
if (!container) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
window.removeEventListener('scroll', this._refreshContainerAsync);
|
|
152
|
-
if (this._detectElementResize) {
|
|
153
|
-
this._detectElementResize.removeResizeListener(this._anchor, this._refreshContainerAsync);
|
|
154
|
-
}
|
|
155
|
-
this._reactRoot?.unmount();
|
|
156
|
-
container.remove();
|
|
157
|
-
this._container = null;
|
|
158
|
-
}
|
|
159
|
-
/** @internal */
|
|
160
|
-
async _refreshContainerAsync() {
|
|
161
|
-
if (!this._container) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
const anchor = this._anchor;
|
|
165
|
-
invariant(anchor instanceof Element, 'No anchor');
|
|
166
|
-
const anchorBoundingClientRect = anchor.getBoundingClientRect();
|
|
167
|
-
const anchorRect = new Geometry.Rect(anchorBoundingClientRect.left, anchorBoundingClientRect.top, anchorBoundingClientRect.width, anchorBoundingClientRect.height);
|
|
168
|
-
const viewportRect = new Geometry.Rect(0, 0, window.innerWidth, window.innerHeight);
|
|
169
|
-
|
|
170
|
-
// Render the tooltip to measure its size. Render it to the right of the anchor element
|
|
171
|
-
// to start. Wait for the async render to complete before measuring. Otherwise, the
|
|
172
|
-
await this._renderPopoverAtPositionAsync(anchorRect.right(), anchorRect.top());
|
|
173
|
-
const measurementPopover = this._popoverContent;
|
|
174
|
-
// HACK(10/17/19): The measurementPopover is sometimes not set, possibly due to some race
|
|
175
|
-
// condition with the the popover being unmounted but we've been unable to identify the root
|
|
176
|
-
// cause. Calling this function again on the next frame works as a workaround. We plan to
|
|
177
|
-
// rebuild popover/tooltip in the new SDK without using ReactDOM.unstable_renderSubtreeIntoContainer,
|
|
178
|
-
// so this is hopefully just a temporary measure.
|
|
179
|
-
if (!measurementPopover) {
|
|
180
|
-
requestAnimationFrame(this._refreshContainerAsync);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const measurementPopoverBoundingRect = measurementPopover.getBoundingClientRect();
|
|
184
|
-
const popoverSize = new Geometry.Size(measurementPopoverBoundingRect.width, measurementPopoverBoundingRect.height);
|
|
185
|
-
let popoverRect = this._getPlacedPopoverRect(popoverSize, anchorRect, this.props.placementX, this.props.placementY);
|
|
186
|
-
if (this.props.fitInWindowMode === FitInWindowModes.FLIP && !this._isRectContainedWithinViewportRect(popoverRect, viewportRect)) {
|
|
187
|
-
// Popover rect is outside the viewport rect, and fitInWindowMode is flip, so
|
|
188
|
-
// let's try flipping the popover.
|
|
189
|
-
let placementX = this.props.placementX;
|
|
190
|
-
let placementY = this.props.placementY;
|
|
191
|
-
if (popoverRect.left() < viewportRect.left()) {
|
|
192
|
-
placementX = PopoverPlacements.RIGHT;
|
|
193
|
-
} else if (popoverRect.right() > viewportRect.right()) {
|
|
194
|
-
placementX = PopoverPlacements.LEFT;
|
|
195
|
-
}
|
|
196
|
-
if (popoverRect.top() < viewportRect.top()) {
|
|
197
|
-
placementY = PopoverPlacements.BOTTOM;
|
|
198
|
-
} else if (popoverRect.bottom() > viewportRect.bottom()) {
|
|
199
|
-
placementY = PopoverPlacements.TOP;
|
|
200
|
-
}
|
|
201
|
-
const flippedPopoverRect = this._getPlacedPopoverRect(popoverSize, anchorRect, placementX, placementY);
|
|
202
|
-
|
|
203
|
-
// Check if the flipped rect is within the viewport before using it. If the flipped rect
|
|
204
|
-
// is also outside the viewport, we might as well just use the original one and then nudge it.
|
|
205
|
-
if (this._isRectContainedWithinViewportRect(flippedPopoverRect, viewportRect)) {
|
|
206
|
-
popoverRect = flippedPopoverRect;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
if (this.props.fitInWindowMode !== FitInWindowModes.NONE) {
|
|
210
|
-
// Check again. If flipping didn't bring it inside viewport bounds,
|
|
211
|
-
// nudge it until it's within the viewport.
|
|
212
|
-
if (popoverRect.left() < viewportRect.left()) {
|
|
213
|
-
popoverRect = new Geometry.Rect(viewportRect.left(), popoverRect.y, popoverRect.width, popoverRect.height);
|
|
214
|
-
} else if (popoverRect.right() > viewportRect.right()) {
|
|
215
|
-
popoverRect = new Geometry.Rect(viewportRect.right() - popoverRect.width, popoverRect.y, popoverRect.width, popoverRect.height);
|
|
216
|
-
}
|
|
217
|
-
if (popoverRect.top() < viewportRect.top()) {
|
|
218
|
-
popoverRect = new Geometry.Rect(popoverRect.x, viewportRect.top(), popoverRect.width, popoverRect.height);
|
|
219
|
-
} else if (popoverRect.bottom() > viewportRect.bottom()) {
|
|
220
|
-
popoverRect = new Geometry.Rect(popoverRect.x, viewportRect.bottom() - popoverRect.height, popoverRect.width, popoverRect.height);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
await this._renderPopoverAtPositionAsync(popoverRect.left(), popoverRect.top());
|
|
224
|
-
}
|
|
225
|
-
/** @internal */
|
|
226
|
-
_isRectContainedWithinViewportRect(rect, viewportRect) {
|
|
227
|
-
if (rect.left() < viewportRect.left() || rect.right() > viewportRect.right() || rect.top() < viewportRect.top() || rect.bottom() > viewportRect.bottom()) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
/** @internal */
|
|
233
|
-
_getPlacedPopoverRect(popoverSize, anchorRect, placementX, placementY) {
|
|
234
|
-
const anchorCenterPoint = anchorRect.centerPoint();
|
|
235
|
-
let x;
|
|
236
|
-
if (placementX === PopoverPlacements.LEFT) {
|
|
237
|
-
x = anchorRect.left() - popoverSize.width - this.props.placementOffsetX;
|
|
238
|
-
} else if (placementX === PopoverPlacements.RIGHT) {
|
|
239
|
-
x = anchorRect.right() + this.props.placementOffsetX;
|
|
240
|
-
} else {
|
|
241
|
-
x = anchorCenterPoint.x - popoverSize.width / 2;
|
|
242
|
-
}
|
|
243
|
-
let y;
|
|
244
|
-
if (placementY === PopoverPlacements.TOP) {
|
|
245
|
-
y = anchorRect.top() - popoverSize.height - this.props.placementOffsetY;
|
|
246
|
-
} else if (placementY === PopoverPlacements.BOTTOM) {
|
|
247
|
-
y = anchorRect.bottom() + this.props.placementOffsetY;
|
|
248
|
-
} else {
|
|
249
|
-
y = anchorCenterPoint.y - popoverSize.height / 2;
|
|
250
|
-
}
|
|
251
|
-
return new Geometry.Rect(x, y, popoverSize.width, popoverSize.height);
|
|
252
|
-
}
|
|
253
|
-
/** @internal */
|
|
254
|
-
async _renderPopoverAtPositionAsync(left, top) {
|
|
255
|
-
let content = this.props.renderContent();
|
|
256
|
-
content = /*#__PURE__*/React.cloneElement(content, {
|
|
257
|
-
ref: el => {
|
|
258
|
-
this._popoverContent = el;
|
|
259
|
-
},
|
|
260
|
-
style: {
|
|
261
|
-
...content.props.style,
|
|
262
|
-
position: 'absolute',
|
|
263
|
-
top,
|
|
264
|
-
left
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
const backgroundClassName = cx(baymax('fixed all-0'), this.props.backgroundClassName);
|
|
268
|
-
const backgroundStyle = this.props.backgroundStyle;
|
|
269
|
-
return new Promise(resolve => {
|
|
270
|
-
const container = this._container;
|
|
271
|
-
invariant(container, 'container must exist');
|
|
272
|
-
const root = this._reactRoot;
|
|
273
|
-
invariant(root, 'root must exist');
|
|
274
|
-
root.render( /*#__PURE__*/React.createElement("div", {
|
|
275
|
-
ref: el => {
|
|
276
|
-
this._background = el;
|
|
277
|
-
resolve();
|
|
278
|
-
},
|
|
279
|
-
className: backgroundClassName,
|
|
280
|
-
style: backgroundStyle,
|
|
281
|
-
onMouseDown: this._onMouseDown,
|
|
282
|
-
onMouseUp: this._onMouseUp
|
|
283
|
-
}, content));
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
/** @internal */
|
|
287
|
-
_onMouseDown(e) {
|
|
288
|
-
if (this._shouldClickingOnElementClosePopover(e.target)) {
|
|
289
|
-
this._mouseDownOutsidePopover = true;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/** @internal */
|
|
293
|
-
_onMouseUp(e) {
|
|
294
|
-
if (this._mouseDownOutsidePopover && this.props.onClose && this._shouldClickingOnElementClosePopover(e.target)) {
|
|
295
|
-
this.props.onClose();
|
|
296
|
-
}
|
|
297
|
-
this._mouseDownOutsidePopover = false;
|
|
298
|
-
}
|
|
299
|
-
/** @internal */
|
|
300
|
-
_shouldClickingOnElementClosePopover(element) {
|
|
301
|
-
return element === this._background;
|
|
302
|
-
}
|
|
303
|
-
/** @hidden */
|
|
304
|
-
render() {
|
|
305
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
306
|
-
ref: el => {
|
|
307
|
-
this._anchor = el;
|
|
308
|
-
}
|
|
309
|
-
}, this.props.children);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
export default Popover;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: ProgressBar */ /** */
|
|
2
|
-
import { cx, css } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { compose } from '@styled-system/core';
|
|
5
|
-
import { clamp } from '../../shared/private_utils';
|
|
6
|
-
import colors from '../../shared/colors';
|
|
7
|
-
import { baymax } from './baymax_utils';
|
|
8
|
-
import useStyledSystem from './use_styled_system';
|
|
9
|
-
import { backgroundColor, maxWidth, minWidth, width, height, flexItemSet, positionSet, margin, display } from './system';
|
|
10
|
-
import Box from './box';
|
|
11
|
-
import theme from './theme/default_theme';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Style props for the {@link ProgressBar} component. Also accepts:
|
|
15
|
-
* * {@link BackgroundColorProps}
|
|
16
|
-
* * {@link FlexItemSetProps}
|
|
17
|
-
* * {@link HeightProps}
|
|
18
|
-
* * {@link MarginProps}
|
|
19
|
-
* * {@link MaxWidthProps}
|
|
20
|
-
* * {@link MinWidthProps}
|
|
21
|
-
* * {@link PositionSetProps}
|
|
22
|
-
* * {@link WidthProps}
|
|
23
|
-
*
|
|
24
|
-
* @noInheritDoc
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const styleParser = compose(backgroundColor, maxWidth, minWidth, width, height, flexItemSet, positionSet, margin, display);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Props for the {@link ProgressBar} component. Also accepts:
|
|
31
|
-
* * {@link ProgressBarStyleProps}
|
|
32
|
-
*
|
|
33
|
-
* @docsPath UI/components/ProgressBar
|
|
34
|
-
* @noInheritDoc
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
// TODO (jay): We can't use Box yet, because `aria-valuenow` is not yet available on `AriaProps`.
|
|
38
|
-
const progressBarClassName = css({
|
|
39
|
-
position: 'relative',
|
|
40
|
-
borderRadius: theme.radii.circle,
|
|
41
|
-
overflow: 'hidden'
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A progress bar.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```js
|
|
49
|
-
* import {ProgressBar} from '@airtable/blocks/base/ui';
|
|
50
|
-
*
|
|
51
|
-
* function MyComponent() {
|
|
52
|
-
* return (
|
|
53
|
-
* <ProgressBar
|
|
54
|
-
* progress={0.6}
|
|
55
|
-
* barColor='#ff9900'
|
|
56
|
-
* />
|
|
57
|
-
* );
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
* @docsPath UI/components/ProgressBar
|
|
61
|
-
* @component
|
|
62
|
-
*/
|
|
63
|
-
const ProgressBar = _ref => {
|
|
64
|
-
let {
|
|
65
|
-
barColor = colors.BLUE_BRIGHT,
|
|
66
|
-
progress,
|
|
67
|
-
onMouseEnter,
|
|
68
|
-
onMouseLeave,
|
|
69
|
-
onClick,
|
|
70
|
-
// This hasOnClick prop is set by the Tooltip wrapper. Destructure it here just to get it out of `props`.
|
|
71
|
-
// See 7a80fefd0a0bc871c31e0c063662c6100b0ca77d
|
|
72
|
-
// TODO(stephen): clean this up.
|
|
73
|
-
hasOnClick,
|
|
74
|
-
className,
|
|
75
|
-
style,
|
|
76
|
-
backgroundColor = colors.GRAY_LIGHT_1,
|
|
77
|
-
width = '100%',
|
|
78
|
-
height = 4,
|
|
79
|
-
...props
|
|
80
|
-
} = _ref;
|
|
81
|
-
const styleProps = {
|
|
82
|
-
backgroundColor,
|
|
83
|
-
width,
|
|
84
|
-
height,
|
|
85
|
-
...props
|
|
86
|
-
};
|
|
87
|
-
const clampedProgressValue = clamp(progress, 0, 1) * 100;
|
|
88
|
-
const classNameForStyleProps = useStyledSystem(styleProps, styleParser);
|
|
89
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
-
role: "progressbar",
|
|
91
|
-
"aria-valuenow": clampedProgressValue
|
|
92
|
-
// TODO (stephen): remove tooltip anchor props
|
|
93
|
-
,
|
|
94
|
-
onMouseEnter: onMouseEnter,
|
|
95
|
-
onMouseLeave: onMouseLeave,
|
|
96
|
-
onClick: onClick,
|
|
97
|
-
className: cx(progressBarClassName, classNameForStyleProps, className),
|
|
98
|
-
style: style
|
|
99
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
100
|
-
className: baymax('animate'),
|
|
101
|
-
width: `${clampedProgressValue}%`,
|
|
102
|
-
height: "100%",
|
|
103
|
-
backgroundColor: barColor
|
|
104
|
-
}));
|
|
105
|
-
};
|
|
106
|
-
export default ProgressBar;
|