@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
|
@@ -41,9 +41,7 @@ export let BlockRunContextType = /*#__PURE__*/function (BlockRunContextType) {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* AirtableInterface is designed as the communication interface between the
|
|
44
|
-
* Block SDK and Airtable.
|
|
45
|
-
* depends on the context in which the block is running (i.e. frontend or backend),
|
|
46
|
-
* but the interface should remain consistent.
|
|
44
|
+
* Block SDK and Airtable.
|
|
47
45
|
*
|
|
48
46
|
* @hidden
|
|
49
47
|
*/
|
|
@@ -1,108 +1,143 @@
|
|
|
1
1
|
/** @hidden */ /** */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { invariant } from '../../shared/error_utils';
|
|
4
|
-
import withHooks from '../../shared/ui/with_hooks';
|
|
5
|
-
import useWatchable from '../../shared/ui/use_watchable';
|
|
6
3
|
import { SdkContext } from '../../shared/ui/sdk_context';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import Loader from '../../shared/ui/loader';
|
|
5
|
+
import { globalAlert, useWatchable } from './ui';
|
|
6
|
+
import { getCssContentToAddToHead, BUTTON_LINK_CLASS_NAME, SPIN_SCALE_ANIMATION_NAME } from './global_css_helpers';
|
|
7
|
+
const suspenseFallbackStyle = {
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
top: 0,
|
|
10
|
+
left: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center'
|
|
16
|
+
};
|
|
17
|
+
const wrapperStyle = {
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
top: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
bottom: 0,
|
|
23
|
+
overflow: 'hidden'
|
|
24
|
+
};
|
|
25
|
+
const fullscreenMessageStyle = {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
right: 0,
|
|
30
|
+
bottom: 0,
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
padding: '1rem',
|
|
35
|
+
backgroundColor: '#ffffff',
|
|
36
|
+
zIndex: 2147483647 // largest 32-bit signed integer (maximum z-index)
|
|
37
|
+
};
|
|
38
|
+
const animateSpinnerStyle = {
|
|
39
|
+
animationIterationCount: 'infinite',
|
|
40
|
+
animationName: SPIN_SCALE_ANIMATION_NAME,
|
|
41
|
+
animationDuration: '1800ms',
|
|
42
|
+
animationTimingFunction: 'cubic-bezier(0.785, 0.135, 0.15, 0.86)'
|
|
43
|
+
};
|
|
44
|
+
export default function BlockWrapper(props) {
|
|
45
|
+
const {
|
|
46
|
+
sdk,
|
|
47
|
+
children
|
|
48
|
+
} = props;
|
|
49
|
+
const [globalAlertInfoIfExists, setGlobalAlertInfoIfExists] = React.useState(null);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
// Once we have a global alert info, we don't need to watch for changes. The
|
|
52
|
+
// global alert will display until the page is reloaded.
|
|
53
|
+
if (globalAlertInfoIfExists) {
|
|
54
|
+
return () => {};
|
|
55
|
+
}
|
|
17
56
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
globalAlert.watch('__alertInfo', () => this.forceUpdate());
|
|
26
|
-
}
|
|
27
|
-
/** @hidden */
|
|
28
|
-
UNSAFE_componentWillMount() {
|
|
29
|
-
this._snapshotMinSizeBeforeRender();
|
|
30
|
-
}
|
|
31
|
-
/** @hidden */
|
|
32
|
-
componentDidMount() {
|
|
33
|
-
this._checkMinSizeConstraintUnchangedAfterRender();
|
|
34
|
-
}
|
|
35
|
-
/** @hidden */
|
|
36
|
-
UNSAFE_componentWillUpdate() {
|
|
37
|
-
this._snapshotMinSizeBeforeRender();
|
|
38
|
-
}
|
|
39
|
-
/** @hidden */
|
|
40
|
-
componentDidUpdate() {
|
|
41
|
-
this._checkMinSizeConstraintUnchangedAfterRender();
|
|
42
|
-
}
|
|
43
|
-
// usually createDataContainer handles re-rendering when watchable values
|
|
44
|
-
// change. As minSize can be changed by child components though, it can
|
|
45
|
-
// change before createDataContainer has a chance to set up watches. To get
|
|
46
|
-
// around this, we take a snapshot of the minSize before render and call
|
|
47
|
-
// .forceUpdate() if its changed after render
|
|
48
|
-
/** @internal */
|
|
49
|
-
_snapshotMinSizeBeforeRender() {
|
|
50
|
-
this._minSizeBeforeRender = this.props.sdk.viewport.minSize;
|
|
51
|
-
}
|
|
52
|
-
/** @internal */
|
|
53
|
-
_checkMinSizeConstraintUnchangedAfterRender() {
|
|
54
|
-
const prevMinSize = this._minSizeBeforeRender;
|
|
55
|
-
invariant(prevMinSize, 'prevMinSize must be set');
|
|
56
|
-
const currentMinSize = this.props.sdk.viewport.minSize;
|
|
57
|
-
if (currentMinSize.width !== prevMinSize.width || currentMinSize.height !== prevMinSize.height) {
|
|
58
|
-
this.forceUpdate();
|
|
57
|
+
// Although we call globalAlert.watch('__alertInfo', ..) below, this will only
|
|
58
|
+
// start watching after the component is mounted. If some child component called
|
|
59
|
+
// globalAlert.showReloadPrompt in its constructor or useEffect (recall that child
|
|
60
|
+
// useEffects run before parent useEffects), then __alertInfo would be set before
|
|
61
|
+
// we start watching it here. Therefore explicitly check if __alertInfo is set.
|
|
62
|
+
if (globalAlert.__alertInfo) {
|
|
63
|
+
setGlobalAlertInfoIfExists(globalAlert.__alertInfo);
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
65
|
+
|
|
66
|
+
// Watch for changes to the global alert info.
|
|
67
|
+
const onAlertInfoChange = a => setGlobalAlertInfoIfExists(a.__alertInfo);
|
|
68
|
+
globalAlert.watch('__alertInfo', onAlertInfoChange);
|
|
69
|
+
return () => {
|
|
70
|
+
globalAlert.unwatch('__alertInfo', onAlertInfoChange);
|
|
71
|
+
};
|
|
72
|
+
}, [globalAlertInfoIfExists]);
|
|
73
|
+
const viewport = sdk.viewport;
|
|
74
|
+
useWatchable(viewport, ['size', 'minSize']);
|
|
75
|
+
// Although we watch for changes to minSize above, if a child component
|
|
76
|
+
// sets minSize in its constructor or useEffect, it can change before useWatchable
|
|
77
|
+
// has a chance to set up watches.
|
|
78
|
+
// To get around this, we take a snapshot of the minSize before render and call
|
|
79
|
+
// .forceUpdate() if its changed after render.
|
|
80
|
+
const minSizeBeforeFirstRender = React.useRef(viewport.minSize);
|
|
81
|
+
const [, forceUpdate] = React.useReducer(x => x + 1, 0);
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (minSizeBeforeFirstRender.current) {
|
|
84
|
+
const prevMinSize = minSizeBeforeFirstRender.current;
|
|
85
|
+
minSizeBeforeFirstRender.current = null;
|
|
86
|
+
const currentMinSize = viewport.minSize;
|
|
87
|
+
if (currentMinSize.width !== prevMinSize.width || currentMinSize.height !== prevMinSize.height) {
|
|
88
|
+
forceUpdate();
|
|
89
|
+
}
|
|
80
90
|
}
|
|
91
|
+
}, [viewport]);
|
|
92
|
+
React.useLayoutEffect(() => {
|
|
93
|
+
// Create a style element and inject the global CSS into document head
|
|
94
|
+
const styleElement = document.createElement('style');
|
|
95
|
+
styleElement.textContent = getCssContentToAddToHead();
|
|
96
|
+
document.head.appendChild(styleElement);
|
|
97
|
+
|
|
98
|
+
// Cleanup: remove the style element when component unmounts
|
|
99
|
+
return () => {
|
|
100
|
+
if (document.head.contains(styleElement)) {
|
|
101
|
+
document.head.removeChild(styleElement);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
if (globalAlertInfoIfExists) {
|
|
81
106
|
return /*#__PURE__*/React.createElement(SdkContext.Provider, {
|
|
82
|
-
value:
|
|
83
|
-
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
84
|
-
fallback: /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: baymax('absolute all-0 flex items-center justify-center')
|
|
86
|
-
}, /*#__PURE__*/React.createElement(Loader, null))
|
|
107
|
+
value: sdk
|
|
87
108
|
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
className: baymax('absolute all-0 flex items-center justify-center p2 white'),
|
|
91
|
-
style: {
|
|
92
|
-
zIndex: 2147483647 // largest 32-bit signed integer (maximum z-index)
|
|
93
|
-
}
|
|
94
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
95
|
-
className: baymax('center line-height-4 quiet strong')
|
|
96
|
-
}, /*#__PURE__*/React.createElement("span", null, "Please make this extension bigger or "), /*#__PURE__*/React.createElement("span", {
|
|
97
|
-
className: baymax('pointer understroke link-unquiet'),
|
|
98
|
-
onClick: () => viewport.enterFullscreenIfPossible()
|
|
99
|
-
}, "fullscreen"))));
|
|
109
|
+
style: fullscreenMessageStyle
|
|
110
|
+
}, globalAlertInfoIfExists.content));
|
|
100
111
|
}
|
|
112
|
+
return /*#__PURE__*/React.createElement(SdkContext.Provider, {
|
|
113
|
+
value: sdk
|
|
114
|
+
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
115
|
+
fallback: /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
style: suspenseFallbackStyle
|
|
117
|
+
}, /*#__PURE__*/React.createElement(Loader, {
|
|
118
|
+
style: animateSpinnerStyle
|
|
119
|
+
}))
|
|
120
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
style: viewport.isSmallerThanMinSize ? wrapperStyle : undefined
|
|
122
|
+
}, children)), viewport.isSmallerThanMinSize && /*#__PURE__*/React.createElement(MakeBiggerOrFullscreenMessage, {
|
|
123
|
+
viewport: viewport
|
|
124
|
+
}));
|
|
101
125
|
}
|
|
102
|
-
|
|
126
|
+
function MakeBiggerOrFullscreenMessage(_ref) {
|
|
103
127
|
let {
|
|
104
|
-
|
|
128
|
+
viewport
|
|
105
129
|
} = _ref;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
130
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
style: fullscreenMessageStyle
|
|
132
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
133
|
+
style: {
|
|
134
|
+
textAlign: 'center',
|
|
135
|
+
lineHeight: 1.5,
|
|
136
|
+
opacity: 0.75,
|
|
137
|
+
fontWeight: 500
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement("span", null, "Please make this extension bigger or "), /*#__PURE__*/React.createElement("span", {
|
|
140
|
+
className: BUTTON_LINK_CLASS_NAME,
|
|
141
|
+
onClick: () => viewport.enterFullscreenIfPossible()
|
|
142
|
+
}, "fullscreen")));
|
|
143
|
+
}
|
|
@@ -1,34 +1,8 @@
|
|
|
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
|
-
/** @module @airtable/blocks/ui: CellRenderer */ /** */
|
|
3
|
-
import { cx } from 'emotion';
|
|
4
1
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { spawnError } from '../../shared/error_utils';
|
|
7
|
-
import { FieldType } from '../../shared/types/field_core';
|
|
8
|
-
import withHooks from '../../shared/ui/with_hooks';
|
|
9
|
-
import useWatchable from '../../shared/ui/use_watchable';
|
|
10
|
-
import { useSdk } from '../../shared/ui/sdk_context';
|
|
11
|
-
import { display, maxWidth, minWidth, width, flexItemSet, positionSet, margin } from './system';
|
|
12
|
-
import useStyledSystem from './use_styled_system';
|
|
13
|
-
import { splitStyleProps } from './with_styled_system';
|
|
2
|
+
import { CellRenderer as CellRendererSharedImpl } from '../../shared/ui/cell_renderer';
|
|
14
3
|
|
|
15
4
|
/**
|
|
16
|
-
*
|
|
17
|
-
* * {@link FlexItemSetProps}
|
|
18
|
-
* * {@link MarginProps}
|
|
19
|
-
* * {@link MaxWidthProps}
|
|
20
|
-
* * {@link MinWidthProps}
|
|
21
|
-
* * {@link PositionSetProps}
|
|
22
|
-
* * {@link WidthProps}
|
|
23
|
-
*
|
|
24
|
-
* @noInheritDoc
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const styleParser = compose(display, flexItemSet, margin, maxWidth, minWidth, positionSet, width);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Props for the {@link CellRenderer} component. Also accepts:
|
|
31
|
-
* * {@link CellRendererStyleProps}
|
|
5
|
+
* Props for the {@link CellRenderer} component.
|
|
32
6
|
*
|
|
33
7
|
* @docsPath UI/components/CellRenderer
|
|
34
8
|
* @noInheritDoc
|
|
@@ -37,154 +11,9 @@ const styleParser = compose(display, flexItemSet, margin, maxWidth, minWidth, po
|
|
|
37
11
|
/**
|
|
38
12
|
* Displays the contents of a cell given a field and record.
|
|
39
13
|
*
|
|
40
|
-
* [[ Story id="cellrenderer--example" title="Cell renderer example" ]]
|
|
41
|
-
*
|
|
42
14
|
* @component
|
|
43
15
|
* @docsPath UI/components/CellRenderer
|
|
44
16
|
*/
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
shouldWrap: true
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/** @hidden */
|
|
52
|
-
constructor(props) {
|
|
53
|
-
super(props);
|
|
54
|
-
this._validateProps(props);
|
|
55
|
-
}
|
|
56
|
-
/** @hidden */
|
|
57
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
58
|
-
this._validateProps(nextProps);
|
|
59
|
-
}
|
|
60
|
-
/** @internal */
|
|
61
|
-
_validateProps(props) {
|
|
62
|
-
if (props.record && !props.record.isDeleted && !props.field.isDeleted && props.record.parentTable.id !== props.field.parentTable.id) {
|
|
63
|
-
throw spawnError('CellRenderer: record %s and field %s do not have the same parent table', props.record.parentTable.id, props.field.parentTable.id);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** @hidden */
|
|
67
|
-
render() {
|
|
68
|
-
const {
|
|
69
|
-
record,
|
|
70
|
-
cellValue,
|
|
71
|
-
field,
|
|
72
|
-
shouldWrap,
|
|
73
|
-
onMouseEnter,
|
|
74
|
-
onMouseLeave,
|
|
75
|
-
onClick,
|
|
76
|
-
className,
|
|
77
|
-
style,
|
|
78
|
-
cellClassName,
|
|
79
|
-
cellStyle,
|
|
80
|
-
renderInvalidCellValue,
|
|
81
|
-
sdk
|
|
82
|
-
} = this.props;
|
|
83
|
-
if (field.isDeleted) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const airtableInterface = sdk.__airtableInterface;
|
|
87
|
-
const appInterface = sdk.__appInterface;
|
|
88
|
-
let cellValueToRender;
|
|
89
|
-
if (record) {
|
|
90
|
-
if (cellValue !== undefined) {
|
|
91
|
-
// eslint-disable-next-line
|
|
92
|
-
console.warn('CellRenderer was given both record and cellValue, choosing to render record value');
|
|
93
|
-
}
|
|
94
|
-
if (record.isDeleted) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
cellValueToRender = record.getCellValue(field.id);
|
|
98
|
-
} else {
|
|
99
|
-
// NOTE: this will not work if you want to render a cell value for
|
|
100
|
-
// foreign record, single/multi select, or single/multi collaborator
|
|
101
|
-
// fields and the cell value is not *currently* valid for that field.
|
|
102
|
-
// i.e. if you want to render a foreign record for a record that
|
|
103
|
-
// does not yet exist, this will throw.
|
|
104
|
-
// TODO: handle "preview" cell values that are not yet valid in the given field
|
|
105
|
-
// but that *could* be.
|
|
106
|
-
// To validate public cell values, we only have validateCellValueForUpdate
|
|
107
|
-
// However, this is not implemented for computed fields (since you can't update them)
|
|
108
|
-
// so we just skip the check.
|
|
109
|
-
// TODO(emma): actually check this somehow.
|
|
110
|
-
if (!field.isComputed) {
|
|
111
|
-
const validationResult = airtableInterface.fieldTypeProvider.validateCellValueForUpdate(appInterface, cellValue, null, field._data);
|
|
112
|
-
if (!validationResult.isValid) {
|
|
113
|
-
if (renderInvalidCellValue) {
|
|
114
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
115
|
-
onMouseEnter: onMouseEnter,
|
|
116
|
-
onMouseLeave: onMouseLeave,
|
|
117
|
-
onClick: onClick,
|
|
118
|
-
className: className,
|
|
119
|
-
style: style
|
|
120
|
-
}, renderInvalidCellValue(cellValue, field));
|
|
121
|
-
} else {
|
|
122
|
-
throw spawnError('Cannot render invalid cell value %s: %s', cellValue, validationResult.reason);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
cellValueToRender = cellValue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// in record.getCellValue, we reformat the cell value to the new public format. in order to
|
|
130
|
-
// make it work with the cell renderer, we need to format it back the other way.
|
|
131
|
-
// Note: we can't use _getRawCellValue here since we also need to handle formatting
|
|
132
|
-
// these in the case where the user passed cellValue instead of a record.
|
|
133
|
-
if (cellValueToRender && field.type === FieldType.MULTIPLE_LOOKUP_VALUES && !airtableInterface.sdkInitData.isUsingNewLookupCellValueFormat) {
|
|
134
|
-
const originalCellValue = cellValueToRender;
|
|
135
|
-
const linkedRecordIdsSet = new Set();
|
|
136
|
-
const valuesByLinkedRecordId = {};
|
|
137
|
-
for (const {
|
|
138
|
-
linkedRecordId,
|
|
139
|
-
value
|
|
140
|
-
} of originalCellValue) {
|
|
141
|
-
linkedRecordIdsSet.add(linkedRecordId);
|
|
142
|
-
if (!valuesByLinkedRecordId[linkedRecordId]) {
|
|
143
|
-
valuesByLinkedRecordId[linkedRecordId] = [];
|
|
144
|
-
}
|
|
145
|
-
valuesByLinkedRecordId[linkedRecordId].push(value);
|
|
146
|
-
}
|
|
147
|
-
cellValueToRender = {
|
|
148
|
-
linkedRecordIds: Array.from(linkedRecordIdsSet),
|
|
149
|
-
valuesByLinkedRecordId
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const {
|
|
153
|
-
cellValueHtml,
|
|
154
|
-
attributes
|
|
155
|
-
} = airtableInterface.fieldTypeProvider.getCellRendererData(appInterface, cellValueToRender, field._data, !!shouldWrap);
|
|
156
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
-
// TODO (stephen): remove tooltip anchor props
|
|
158
|
-
onMouseEnter: onMouseEnter,
|
|
159
|
-
onMouseLeave: onMouseLeave,
|
|
160
|
-
onClick: onClick,
|
|
161
|
-
className: cx('baymax', className),
|
|
162
|
-
style: style
|
|
163
|
-
}, /*#__PURE__*/React.createElement("div", _extends({}, attributes, {
|
|
164
|
-
className: cx('cell read', cellClassName),
|
|
165
|
-
style: cellStyle,
|
|
166
|
-
dangerouslySetInnerHTML: {
|
|
167
|
-
__html: cellValueHtml
|
|
168
|
-
}
|
|
169
|
-
})));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
export default withHooks(CellRenderer, props => {
|
|
173
|
-
const {
|
|
174
|
-
styleProps,
|
|
175
|
-
nonStyleProps
|
|
176
|
-
} = splitStyleProps(props, styleParser.propNames, {
|
|
177
|
-
display: 'block'
|
|
178
|
-
});
|
|
179
|
-
const {
|
|
180
|
-
className
|
|
181
|
-
} = nonStyleProps;
|
|
182
|
-
const classNameForStyleProps = useStyledSystem(styleProps, styleParser);
|
|
183
|
-
const sdk = useSdk();
|
|
184
|
-
useWatchable(props.record, [`cellValueInField:${props.field.id}`]);
|
|
185
|
-
useWatchable(props.field, ['type', 'options']);
|
|
186
|
-
return {
|
|
187
|
-
className: cx(classNameForStyleProps, className),
|
|
188
|
-
sdk
|
|
189
|
-
};
|
|
190
|
-
});
|
|
17
|
+
export default function CellRenderer(props) {
|
|
18
|
+
return /*#__PURE__*/React.createElement(CellRendererSharedImpl, props);
|
|
19
|
+
}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { isEnumValue } from '../../shared/private_utils';
|
|
4
4
|
import Watchable from '../../shared/watchable';
|
|
5
5
|
import { useSdk } from '../../shared/ui/sdk_context';
|
|
6
|
-
import {
|
|
6
|
+
import { BUTTON_LINK_CLASS_NAME } from './global_css_helpers';
|
|
7
7
|
const WatchableGlobalAlertKeys = Object.freeze({
|
|
8
8
|
__alertInfo: '__alertInfo'
|
|
9
9
|
});
|
|
@@ -14,9 +14,13 @@ const WatchableGlobalAlertKeys = Object.freeze({
|
|
|
14
14
|
const GlobalAlertInfo = () => {
|
|
15
15
|
const sdk = useSdk();
|
|
16
16
|
return /*#__PURE__*/React.createElement("span", {
|
|
17
|
-
|
|
17
|
+
style: {
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
lineHeight: 1.5,
|
|
20
|
+
fontWeight: 500
|
|
21
|
+
}
|
|
18
22
|
}, /*#__PURE__*/React.createElement("span", {
|
|
19
|
-
className:
|
|
23
|
+
className: BUTTON_LINK_CLASS_NAME,
|
|
20
24
|
onClick: () => {
|
|
21
25
|
sdk.reload();
|
|
22
26
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const SPIN_SCALE_ANIMATION_NAME = `spinScale_${Math.random().toString(36).substring(2, 11)}`;
|
|
2
|
+
export const BUTTON_LINK_CLASS_NAME = `buttonLink_${Math.random().toString(36).substring(2, 11)}`;
|
|
3
|
+
const spinScaleKeyframesStyle = `
|
|
4
|
+
@keyframes ${SPIN_SCALE_ANIMATION_NAME} {
|
|
5
|
+
0% {
|
|
6
|
+
transform: rotate(0) scale(1);
|
|
7
|
+
}
|
|
8
|
+
50% {
|
|
9
|
+
transform: rotate(360deg) scale(0.9);
|
|
10
|
+
}
|
|
11
|
+
100% {
|
|
12
|
+
transform: rotate(720deg) scale(1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const buttonLinkStyle = `
|
|
17
|
+
.${BUTTON_LINK_CLASS_NAME} {
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
padding-bottom: 0.14rem;
|
|
20
|
+
border-bottom: 2px solid hsla(0, 0%, 0%, 0.1);
|
|
21
|
+
}
|
|
22
|
+
.${BUTTON_LINK_CLASS_NAME}:hover {
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
export const getCssContentToAddToHead = () => {
|
|
27
|
+
return `${spinScaleKeyframesStyle}\n${buttonLinkStyle}`;
|
|
28
|
+
};
|
package/dist/esm/base/ui/ui.js
CHANGED
|
@@ -8,32 +8,12 @@ import GlobalAlert from './global_alert';
|
|
|
8
8
|
// instead importing `unstable_standalone_ui`.
|
|
9
9
|
import '..';
|
|
10
10
|
export { default as BaseProvider } from './base_provider';
|
|
11
|
-
export {
|
|
12
|
-
export { default as colorUtils } from '../../shared/color_utils';
|
|
13
|
-
export { default as Synced } from './synced';
|
|
14
|
-
export { default as TablePicker } from './table_picker';
|
|
15
|
-
export { default as TablePickerSynced } from './table_picker_synced';
|
|
16
|
-
export { default as FieldPicker } from './field_picker';
|
|
17
|
-
export { default as FieldPickerSynced } from './field_picker_synced';
|
|
18
|
-
export { default as ViewPicker } from './view_picker';
|
|
19
|
-
export { default as ViewPickerSynced } from './view_picker_synced';
|
|
20
|
-
export { default as InputSynced } from './input_synced';
|
|
11
|
+
export { initializeBlock } from './initialize_block';
|
|
21
12
|
export { default as CellRenderer } from './cell_renderer';
|
|
22
13
|
export { default as expandRecord } from './expand_record';
|
|
23
14
|
export { default as expandRecordList } from './expand_record_list';
|
|
24
15
|
export { default as expandRecordPickerAsync } from './expand_record_picker_async';
|
|
25
16
|
export { default as GlobalAlert } from './global_alert';
|
|
26
|
-
export { default as FieldIcon } from './field_icon';
|
|
27
|
-
export { default as ColorPaletteSynced } from './color_palette_synced';
|
|
28
|
-
export { default as ProgressBar } from './progress_bar';
|
|
29
|
-
export { default as RecordCard } from './record_card';
|
|
30
|
-
export { default as RecordCardList } from './record_card_list';
|
|
31
|
-
export { default as SelectSynced } from './select_synced';
|
|
32
|
-
export { default as SelectButtonsSynced } from './select_buttons_synced';
|
|
33
|
-
export { default as SwitchSynced } from './switch_synced';
|
|
34
|
-
export { default as ViewportConstraint } from './viewport_constraint';
|
|
35
|
-
export { initializeBlock } from './initialize_block';
|
|
36
|
-
export { default as withHooks } from '../../shared/ui/with_hooks';
|
|
37
17
|
export { default as useLoadable } from './use_loadable';
|
|
38
18
|
export { useColorScheme } from '../../shared/ui/use_color_scheme';
|
|
39
19
|
export { useRecordIds, useRecords, useRecordById, useRecordQueryResult } from './use_records';
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
// This module is maintained as an entry point for consumers who cannot provide
|
|
2
|
-
// an implementation of AirtableInterface. Unlike the larger `ui` module, this
|
|
3
|
-
// module can be imported without an AirtableInterface implementation (and the
|
|
4
|
-
// UI Components can function in such an environment).
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
1
|
+
// // This module is maintained as an entry point for consumers who cannot provide
|
|
2
|
+
// // an implementation of AirtableInterface. Unlike the larger `ui` module, this
|
|
3
|
+
// // module can be imported without an AirtableInterface implementation (and the
|
|
4
|
+
// // UI Components can function in such an environment).
|
|
5
|
+
// export {default as Box} from './box';
|
|
6
|
+
// export {default as Button} from './button';
|
|
7
|
+
// export {default as ChoiceToken} from './choice_token';
|
|
8
|
+
// export {default as CollaboratorToken} from './collaborator_token';
|
|
9
|
+
// export {default as ColorPalette} from './color_palette';
|
|
10
|
+
// export {default as ConfirmationDialog} from './confirmation_dialog';
|
|
11
|
+
// export {default as Dialog} from './dialog';
|
|
12
|
+
// export {default as FormField} from './form_field';
|
|
13
|
+
// export {default as Heading} from './heading';
|
|
14
|
+
// export {default as Icon} from './icon';
|
|
15
|
+
// export {default as Input} from './input';
|
|
16
|
+
// export {default as Label} from './label';
|
|
17
|
+
// export {default as Link} from './link';
|
|
18
|
+
// export {default as Loader} from './loader';
|
|
19
|
+
// export {default as Modal} from './modal';
|
|
20
|
+
// export {default as Popover} from './popover';
|
|
21
|
+
export { default as colors } from '../../shared/colors';
|
|
22
|
+
export { default as colorUtils } from '../../shared/color_utils';
|
|
21
23
|
export { loadCSSFromString, loadCSSFromURLAsync, loadScriptFromURLAsync } from '../../shared/ui/remote_utils';
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
24
|
+
// export {default as Select} from './select';
|
|
25
|
+
// export {default as SelectButtons} from './select_buttons';
|
|
26
|
+
// export {default as Switch} from './switch';
|
|
27
|
+
// export {default as Text} from './text';
|
|
28
|
+
// export {default as TextButton} from './text_button';
|
|
29
|
+
// export {default as Tooltip} from './tooltip';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @module @airtable/blocks/ui: useLoadable */ /** */
|
|
2
|
-
import { useMemo, useEffect } from 'react';
|
|
3
|
-
import { useSubscription } from 'use-subscription';
|
|
2
|
+
import { useMemo, useEffect, useSyncExternalStore } from 'react';
|
|
4
3
|
import { compact, has } from '../../shared/private_utils';
|
|
5
4
|
import { spawnError } from '../../shared/error_utils';
|
|
6
5
|
import useArrayIdentity from '../../shared/ui/use_array_identity';
|
|
@@ -149,7 +148,7 @@ export default function useLoadable(models) {
|
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
150
|
}), [compactModels]);
|
|
152
|
-
|
|
151
|
+
useSyncExternalStore(modelIsLoadedSubscription.subscribe, modelIsLoadedSubscription.getCurrentValue);
|
|
153
152
|
|
|
154
153
|
// the main part of this hook comes down to managing the query result data loading in sync with
|
|
155
154
|
// the component lifecycle. That means loading the data when the component mounts, and
|
|
@@ -22,6 +22,7 @@ export let BlockInstallationPageElementCustomPropertyTypeForAirtableInterface =
|
|
|
22
22
|
BlockInstallationPageElementCustomPropertyTypeForAirtableInterface["STRING"] = "string";
|
|
23
23
|
BlockInstallationPageElementCustomPropertyTypeForAirtableInterface["ENUM"] = "enum";
|
|
24
24
|
BlockInstallationPageElementCustomPropertyTypeForAirtableInterface["FIELD_ID"] = "fieldId";
|
|
25
|
+
BlockInstallationPageElementCustomPropertyTypeForAirtableInterface["TABLE_ID"] = "tableId";
|
|
25
26
|
return BlockInstallationPageElementCustomPropertyTypeForAirtableInterface;
|
|
26
27
|
}({});
|
|
27
28
|
|
|
@@ -31,9 +32,7 @@ export let BlockInstallationPageElementCustomPropertyTypeForAirtableInterface =
|
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* AirtableInterface is designed as the communication interface between the
|
|
34
|
-
* Block SDK and Airtable.
|
|
35
|
-
* depends on the context in which the block is running (i.e. frontend or backend),
|
|
36
|
-
* but the interface should remain consistent.
|
|
35
|
+
* Block SDK and Airtable.
|
|
37
36
|
*
|
|
38
37
|
* @hidden
|
|
39
38
|
*/
|