@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,84 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: ChoiceToken */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { compose } from '@styled-system/core';
|
|
5
|
-
import { baymax } from './baymax_utils';
|
|
6
|
-
import Box from './box';
|
|
7
|
-
import Text from './text';
|
|
8
|
-
import useStyledSystem from './use_styled_system';
|
|
9
|
-
import useTextColorForBackgroundColor from './use_text_color_for_background_color';
|
|
10
|
-
import { flexItemSet, positionSet, margin } from './system';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Style props for the {@link ChoiceToken} component. Accepts:
|
|
14
|
-
* * {@link FlexItemSetProps}
|
|
15
|
-
* * {@link MarginProps}
|
|
16
|
-
* * {@link PositionSetProps}
|
|
17
|
-
*
|
|
18
|
-
* @noInheritDoc
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const styleParser = compose(flexItemSet, positionSet, margin);
|
|
22
|
-
const DEFAULT_CHOICE_COLOR = 'gray';
|
|
23
|
-
|
|
24
|
-
/** An option from a select field. You should not create these objects from scratch, but should instead grab them from base data. */
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Props for the {@link ChoiceToken} component. Also accepts:
|
|
28
|
-
* * {@link ChoiceTokenStyleProps}
|
|
29
|
-
*
|
|
30
|
-
* @docsPath UI/components/ChoiceToken
|
|
31
|
-
* @noInheritDoc
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A component that shows a single choice in a small token, to be displayed inline or in a list of choices.
|
|
36
|
-
*
|
|
37
|
-
* [[ Story id="choicetoken--example" title="Choice token example" ]]
|
|
38
|
-
*
|
|
39
|
-
* @component
|
|
40
|
-
* @docsPath UI/components/ChoiceToken
|
|
41
|
-
*/
|
|
42
|
-
const ChoiceToken = props => {
|
|
43
|
-
const {
|
|
44
|
-
choice,
|
|
45
|
-
onMouseEnter,
|
|
46
|
-
onMouseLeave,
|
|
47
|
-
onClick,
|
|
48
|
-
// This hasOnClick prop is set by the Tooltip wrapper. Destructure it here just to get it out of `props`.
|
|
49
|
-
// See 7a80fefd0a0bc871c31e0c063662c6100b0ca77d
|
|
50
|
-
// TODO(stephen): clean this up.
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
|
-
hasOnClick,
|
|
53
|
-
className,
|
|
54
|
-
style,
|
|
55
|
-
...styleProps
|
|
56
|
-
} = props;
|
|
57
|
-
const classNameForStyleProps = useStyledSystem(styleProps, styleParser);
|
|
58
|
-
const color = choice.color || DEFAULT_CHOICE_COLOR;
|
|
59
|
-
const textColor = useTextColorForBackgroundColor(color);
|
|
60
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
61
|
-
className: cx(className, classNameForStyleProps),
|
|
62
|
-
style: style,
|
|
63
|
-
display: "inline-block"
|
|
64
|
-
}, /*#__PURE__*/React.createElement(Box
|
|
65
|
-
// TODO (stephen): remove tooltip anchor props
|
|
66
|
-
, {
|
|
67
|
-
onMouseEnter: onMouseEnter,
|
|
68
|
-
onMouseLeave: onMouseLeave,
|
|
69
|
-
onClick: onClick,
|
|
70
|
-
className: baymax('print-color-exact align-top border-box'),
|
|
71
|
-
backgroundColor: color,
|
|
72
|
-
minWidth: "18px",
|
|
73
|
-
height: "18px",
|
|
74
|
-
borderRadius: "circle",
|
|
75
|
-
paddingX: 2
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
77
|
-
className: baymax('truncate'),
|
|
78
|
-
textColor: textColor,
|
|
79
|
-
fontSize: "13px",
|
|
80
|
-
fontWeight: "400",
|
|
81
|
-
lineHeight: 1.5
|
|
82
|
-
}, choice.name)));
|
|
83
|
-
};
|
|
84
|
-
export default ChoiceToken;
|
|
@@ -1,115 +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
|
-
/** @module @airtable/blocks/ui: CollaboratorToken */ /** */
|
|
3
|
-
import { cx } from 'emotion';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { compose } from '@styled-system/core';
|
|
6
|
-
import useBase from '../../shared/ui/use_base';
|
|
7
|
-
import Box from './box';
|
|
8
|
-
import Text from './text';
|
|
9
|
-
import { baymax } from './baymax_utils';
|
|
10
|
-
import useStyledSystem from './use_styled_system';
|
|
11
|
-
import { flexItemSet, positionSet, margin } from './system';
|
|
12
|
-
const UNKNOWN_PROFILE_PIC_URL = 'https://static.airtable.com/images/userIcons/user_icon_unknown.png';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Style props for the {@link CollaboratorToken} component. Accepts:
|
|
16
|
-
* * {@link FlexItemSetProps}
|
|
17
|
-
* * {@link MarginProps}
|
|
18
|
-
* * {@link PositionSetProps}
|
|
19
|
-
*
|
|
20
|
-
* @noInheritDoc
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const styleParser = compose(flexItemSet, positionSet, margin);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Props for the {@link CollaboratorToken} component. Also accepts:
|
|
27
|
-
* * {@link CollaboratorTokenStyleProps}
|
|
28
|
-
*
|
|
29
|
-
* @noInheritDoc
|
|
30
|
-
* @docsPath UI/components/CollaboratorToken
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A version of `Collaborator` that doesn't connect to base. Not part of the public API.
|
|
35
|
-
*
|
|
36
|
-
* @hidden
|
|
37
|
-
*/
|
|
38
|
-
const StaticCollaboratorToken = props => {
|
|
39
|
-
const {
|
|
40
|
-
collaborator,
|
|
41
|
-
isActive = true,
|
|
42
|
-
onMouseEnter,
|
|
43
|
-
onMouseLeave,
|
|
44
|
-
onClick,
|
|
45
|
-
// This hasOnClick prop is set by the Tooltip wrapper. Destructure it here just to get it out of `props`.
|
|
46
|
-
// See 7a80fefd0a0bc871c31e0c063662c6100b0ca77d
|
|
47
|
-
// TODO(stephen): clean this up.
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
-
hasOnClick,
|
|
50
|
-
className,
|
|
51
|
-
style,
|
|
52
|
-
...styleProps
|
|
53
|
-
} = props;
|
|
54
|
-
const classNameForStyledProps = useStyledSystem(styleProps, styleParser);
|
|
55
|
-
const userName = collaborator.name || collaborator.email || 'Unknown';
|
|
56
|
-
const profilePicUrl = collaborator.profilePicUrl || UNKNOWN_PROFILE_PIC_URL;
|
|
57
|
-
return /*#__PURE__*/React.createElement(Box
|
|
58
|
-
// TODO (stephen): remove tooltip anchor props
|
|
59
|
-
, {
|
|
60
|
-
onMouseEnter: onMouseEnter,
|
|
61
|
-
onMouseLeave: onMouseLeave,
|
|
62
|
-
onClick: onClick,
|
|
63
|
-
className: cx(baymax('truncate print-color-exact'), classNameForStyledProps, className),
|
|
64
|
-
style: style,
|
|
65
|
-
alignItems: "center",
|
|
66
|
-
display: "inline-flex",
|
|
67
|
-
opacity: isActive ? 1 : 0.5
|
|
68
|
-
}, profilePicUrl && /*#__PURE__*/React.createElement(Box, {
|
|
69
|
-
className: baymax('background-cover background-center'),
|
|
70
|
-
style: {
|
|
71
|
-
backgroundImage: `url("${profilePicUrl}")`
|
|
72
|
-
},
|
|
73
|
-
border: "1px solid #eee",
|
|
74
|
-
width: "22px",
|
|
75
|
-
height: "22px",
|
|
76
|
-
borderRadius: "circle",
|
|
77
|
-
zIndex: 1,
|
|
78
|
-
flex: "none",
|
|
79
|
-
backgroundColor: "grayLight2"
|
|
80
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
|
81
|
-
className: baymax('truncate'),
|
|
82
|
-
paddingRight: 2,
|
|
83
|
-
paddingLeft: 3,
|
|
84
|
-
textColor: "dark",
|
|
85
|
-
display: "inline-flex",
|
|
86
|
-
borderRadius: "circle",
|
|
87
|
-
alignItems: "center",
|
|
88
|
-
flex: "none",
|
|
89
|
-
backgroundColor: "grayLight2",
|
|
90
|
-
marginLeft: "-12px",
|
|
91
|
-
lineHeight: 1.4
|
|
92
|
-
}, userName));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* A component that shows a single collaborator in a small token, to be displayed inline or in a list of choices.
|
|
97
|
-
*
|
|
98
|
-
* [[ Story id="collaboratortoken--example" title="Collaborator token example" ]]
|
|
99
|
-
*
|
|
100
|
-
* @component
|
|
101
|
-
* @docsPath UI/components/CollaboratorToken
|
|
102
|
-
*/
|
|
103
|
-
const CollaboratorToken = props => {
|
|
104
|
-
// Re-render when collaborator info updates. This is to ensure isActive is accurate.
|
|
105
|
-
const base = useBase();
|
|
106
|
-
const activeCollaborators = base.activeCollaborators;
|
|
107
|
-
const isActive = activeCollaborators.some(activeCollaborator => {
|
|
108
|
-
return activeCollaborator.id === props.collaborator.id;
|
|
109
|
-
});
|
|
110
|
-
return /*#__PURE__*/React.createElement(StaticCollaboratorToken, _extends({}, props, {
|
|
111
|
-
isActive: isActive
|
|
112
|
-
}));
|
|
113
|
-
};
|
|
114
|
-
CollaboratorToken.Static = StaticCollaboratorToken;
|
|
115
|
-
export default CollaboratorToken;
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: ColorPalette */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { compose } from '@styled-system/core';
|
|
5
|
-
import { invariant } from '../../shared/error_utils';
|
|
6
|
-
import colorUtils from '../../shared/color_utils';
|
|
7
|
-
import { baymax } from './baymax_utils';
|
|
8
|
-
import Box from './box';
|
|
9
|
-
import Icon from './icon';
|
|
10
|
-
import createDetectElementResize from './create_detect_element_resize';
|
|
11
|
-
import withStyledSystem from './with_styled_system';
|
|
12
|
-
import { maxWidth, minWidth, width, flexItemSet, positionSet, margin } from './system';
|
|
13
|
-
const MIN_COLOR_SQUARE_SIZE = 16;
|
|
14
|
-
const DEFAULT_COLOR_SQUARE_SIZE = 24;
|
|
15
|
-
const MAX_COLOR_SQUARE_SIZE = 32;
|
|
16
|
-
|
|
17
|
-
// TODO: it's confusing that this expects color names, but other components
|
|
18
|
-
// expect a CSS color string.
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Style props shared between the {@link ColorPalette} and {@link ColorPaletteSynced} components. Accepts:
|
|
22
|
-
* * {@link FlexItemSetProps}
|
|
23
|
-
* * {@link MarginProps}
|
|
24
|
-
* * {@link MaxWidthProps}
|
|
25
|
-
* * {@link MinWidthProps}
|
|
26
|
-
* * {@link PositionSetProps}
|
|
27
|
-
* * {@link WidthProps}
|
|
28
|
-
*
|
|
29
|
-
* @noInheritDoc
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
const styleParser = compose(maxWidth, minWidth, width, flexItemSet, positionSet, margin);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Props shared between the {@link ColorPalette} and {@link ColorPaletteSynced} components.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Props for the {@link ColorPalette} component. Also accepts:
|
|
40
|
-
* * {@link ColorPaletteStyleProps}
|
|
41
|
-
*
|
|
42
|
-
* @docsPath UI/components/ColorPalette
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/** @hidden */
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* A color selection component. Accepts a list of `allowedColors` to be displayed
|
|
49
|
-
* as selectable color squares.
|
|
50
|
-
*
|
|
51
|
-
* [[ Story id="colorpalette--example" title="Color palette example" ]]
|
|
52
|
-
*
|
|
53
|
-
* @component
|
|
54
|
-
* @docsPath UI/components/ColorPalette
|
|
55
|
-
*/
|
|
56
|
-
export class ColorPalette extends React.Component {
|
|
57
|
-
/** @hidden */
|
|
58
|
-
static defaultProps = {
|
|
59
|
-
squareMargin: 4,
|
|
60
|
-
className: '',
|
|
61
|
-
style: {}
|
|
62
|
-
};
|
|
63
|
-
/** @internal */
|
|
64
|
-
|
|
65
|
-
/** @internal */
|
|
66
|
-
|
|
67
|
-
/** @hidden */
|
|
68
|
-
constructor(props) {
|
|
69
|
-
super(props);
|
|
70
|
-
this._detectElementResize = createDetectElementResize();
|
|
71
|
-
this._colorPaletteContainerRef = /*#__PURE__*/React.createRef();
|
|
72
|
-
this._setColorSquareSize = this._setColorSquareSize.bind(this);
|
|
73
|
-
this.state = {
|
|
74
|
-
squareSize: DEFAULT_COLOR_SQUARE_SIZE
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/** @hidden */
|
|
78
|
-
componentDidMount() {
|
|
79
|
-
if (this._colorPaletteContainerRef.current) {
|
|
80
|
-
this._detectElementResize.addResizeListener(this._colorPaletteContainerRef.current, this._setColorSquareSize);
|
|
81
|
-
}
|
|
82
|
-
this._setColorSquareSize();
|
|
83
|
-
}
|
|
84
|
-
/** @hidden */
|
|
85
|
-
componentWillUnmount() {
|
|
86
|
-
if (this._colorPaletteContainerRef.current) {
|
|
87
|
-
this._detectElementResize.removeResizeListener(this._colorPaletteContainerRef.current, this._setColorSquareSize);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/** @hidden */
|
|
91
|
-
componentDidUpdate(prevProps) {
|
|
92
|
-
if (this.props.allowedColors.length !== prevProps.allowedColors.length) {
|
|
93
|
-
this._setColorSquareSize();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Attempts to fit all `allowedColors` onto one line by adjusting color square size.
|
|
97
|
-
/** @internal */
|
|
98
|
-
_setColorSquareSize() {
|
|
99
|
-
const {
|
|
100
|
-
squareMargin
|
|
101
|
-
} = this.props;
|
|
102
|
-
invariant(squareMargin !== null && squareMargin !== undefined, 'colorPalette.squareMargin must be a number');
|
|
103
|
-
invariant(this._colorPaletteContainerRef.current, 'No container to set color square size');
|
|
104
|
-
|
|
105
|
-
// Calculates the size of each square required to fit `numSquares` squares on one line.
|
|
106
|
-
const calculateSquareSize = numSquares => {
|
|
107
|
-
return (containerWidth - squareMargin * 2 * numSquares) / numSquares;
|
|
108
|
-
};
|
|
109
|
-
const containerWidth = this._colorPaletteContainerRef.current.getBoundingClientRect().width;
|
|
110
|
-
const numColors = this.props.allowedColors.length;
|
|
111
|
-
const calculatedSquareSize = calculateSquareSize(numColors);
|
|
112
|
-
let squareSize;
|
|
113
|
-
// If we can't fit them all in one line, find the closest square size to the default that
|
|
114
|
-
// fills the row and let flexbox wrap the remainder
|
|
115
|
-
if (calculatedSquareSize < MIN_COLOR_SQUARE_SIZE) {
|
|
116
|
-
const numColorsThatWillFitAsDefaultSize = Math.round((containerWidth + 2 * squareMargin) / (DEFAULT_COLOR_SQUARE_SIZE + 2 * squareMargin));
|
|
117
|
-
squareSize = squareSize = numColorsThatWillFitAsDefaultSize === 0 ? DEFAULT_COLOR_SQUARE_SIZE : calculateSquareSize(numColorsThatWillFitAsDefaultSize);
|
|
118
|
-
} else {
|
|
119
|
-
squareSize = Math.min(MAX_COLOR_SQUARE_SIZE, calculatedSquareSize);
|
|
120
|
-
}
|
|
121
|
-
this.setState({
|
|
122
|
-
squareSize
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
/** @internal */
|
|
126
|
-
_onChange(color) {
|
|
127
|
-
if (this.props.onChange) {
|
|
128
|
-
this.props.onChange(color);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/** @hidden */
|
|
132
|
-
render() {
|
|
133
|
-
const {
|
|
134
|
-
color,
|
|
135
|
-
allowedColors,
|
|
136
|
-
squareMargin,
|
|
137
|
-
onMouseEnter,
|
|
138
|
-
onMouseLeave,
|
|
139
|
-
onClick,
|
|
140
|
-
className,
|
|
141
|
-
style,
|
|
142
|
-
disabled
|
|
143
|
-
} = this.props;
|
|
144
|
-
const {
|
|
145
|
-
squareSize
|
|
146
|
-
} = this.state;
|
|
147
|
-
invariant(squareMargin !== null && squareMargin !== undefined, 'colorPalette.squareMargin must be a number');
|
|
148
|
-
return /*#__PURE__*/React.createElement(Box
|
|
149
|
-
// TODO (stephen): remove tooltip anchor props
|
|
150
|
-
, {
|
|
151
|
-
onMouseEnter: onMouseEnter,
|
|
152
|
-
onMouseLeave: onMouseLeave,
|
|
153
|
-
onClick: onClick,
|
|
154
|
-
className: className,
|
|
155
|
-
style: style,
|
|
156
|
-
overflow: "hidden"
|
|
157
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
158
|
-
ref: this._colorPaletteContainerRef,
|
|
159
|
-
display: "flex",
|
|
160
|
-
flexWrap: "wrap"
|
|
161
|
-
// Add a negative margin to offset the margin of each swatch,
|
|
162
|
-
// so the color swatches are flush with the outer container.
|
|
163
|
-
,
|
|
164
|
-
margin: `${-squareMargin}px`
|
|
165
|
-
}, allowedColors.map(allowedColor => /*#__PURE__*/React.createElement("label", {
|
|
166
|
-
key: allowedColor,
|
|
167
|
-
onClick: disabled ? undefined : () => this._onChange(allowedColor),
|
|
168
|
-
style: {
|
|
169
|
-
backgroundColor: colorUtils.getHexForColor(allowedColor) || undefined,
|
|
170
|
-
height: squareSize,
|
|
171
|
-
width: squareSize,
|
|
172
|
-
margin: squareMargin
|
|
173
|
-
},
|
|
174
|
-
className: cx(baymax('rounded flex items-center justify-center'), {
|
|
175
|
-
[baymax('pointer link-quiet')]: !disabled,
|
|
176
|
-
[baymax('quieter')]: !!disabled
|
|
177
|
-
})
|
|
178
|
-
}, allowedColor === color && /*#__PURE__*/React.createElement(Icon, {
|
|
179
|
-
name: "check",
|
|
180
|
-
size: squareSize,
|
|
181
|
-
className: baymax(colorUtils.shouldUseLightTextOnColor(allowedColor) ? 'text-white' : 'text-dark')
|
|
182
|
-
})))));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
export default withStyledSystem(ColorPalette, styleParser, {});
|
|
@@ -1,62 +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
|
-
/** @module @airtable/blocks/ui: ColorPalette */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { spawnError } from '../../shared/error_utils';
|
|
5
|
-
import Synced from './synced';
|
|
6
|
-
import ColorPalette from './color_palette';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Props for the {@link ColorPaletteSynced} component. Also accepts:
|
|
10
|
-
* * {@link ColorPaletteStyleProps}
|
|
11
|
-
*
|
|
12
|
-
* @docsPath UI/components/ColorPaletteSynced
|
|
13
|
-
* @groupPath UI/components/ColorPalette
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A wrapper around the {@link ColorPalette} component that syncs with {@link GlobalConfig}.
|
|
18
|
-
*
|
|
19
|
-
* [[ Story id="colorpalette--synced-example" title="Synced color palette example" ]]
|
|
20
|
-
*
|
|
21
|
-
* @component
|
|
22
|
-
* @docsPath UI/components/ColorPaletteSynced
|
|
23
|
-
* @groupPath UI/components/ColorPalette
|
|
24
|
-
*/
|
|
25
|
-
class ColorPaletteSynced extends React.Component {
|
|
26
|
-
/** @hidden */
|
|
27
|
-
render() {
|
|
28
|
-
const {
|
|
29
|
-
globalConfigKey,
|
|
30
|
-
disabled,
|
|
31
|
-
onChange,
|
|
32
|
-
...restOfProps
|
|
33
|
-
} = this.props;
|
|
34
|
-
return /*#__PURE__*/React.createElement(Synced, {
|
|
35
|
-
globalConfigKey: globalConfigKey,
|
|
36
|
-
render: _ref => {
|
|
37
|
-
let {
|
|
38
|
-
value,
|
|
39
|
-
canSetValue,
|
|
40
|
-
setValue
|
|
41
|
-
} = _ref;
|
|
42
|
-
let currentColor;
|
|
43
|
-
if (typeof value === 'string' || value === null || value === undefined) {
|
|
44
|
-
currentColor = value;
|
|
45
|
-
} else {
|
|
46
|
-
spawnError('ColorPaletteSynced only works with a global config value that is a string, null, or undefined');
|
|
47
|
-
}
|
|
48
|
-
return /*#__PURE__*/React.createElement(ColorPalette, _extends({}, restOfProps, {
|
|
49
|
-
color: currentColor,
|
|
50
|
-
onChange: newValue => {
|
|
51
|
-
setValue(newValue);
|
|
52
|
-
if (onChange) {
|
|
53
|
-
onChange(newValue);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
disabled: disabled || !canSetValue
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export default ColorPaletteSynced;
|
|
@@ -1,96 +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
|
-
/** @module @airtable/blocks/ui: Dialog */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import Dialog from './dialog';
|
|
5
|
-
import Heading from './heading';
|
|
6
|
-
import Text from './text';
|
|
7
|
-
import Button from './button';
|
|
8
|
-
import Box from './box';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Props for the {@link ConfirmationDialog} component. Also accepts:
|
|
12
|
-
* * {@link DialogStyleProps}
|
|
13
|
-
*
|
|
14
|
-
* @noInheritDoc
|
|
15
|
-
* @docsPath UI/components/ConfirmationDialog
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A styled modal dialog component that prompts the user to confirm or cancel an action.
|
|
20
|
-
*
|
|
21
|
-
* [[ Story id="confirmationdialog--example" title="Confirmation dialog example" ]]
|
|
22
|
-
*
|
|
23
|
-
* By default, this component will focus the "Confirm" button on mount, so that pressing
|
|
24
|
-
* the Enter key will confirm the action.
|
|
25
|
-
*
|
|
26
|
-
* @component
|
|
27
|
-
* @docsPath UI/components/ConfirmationDialog
|
|
28
|
-
*/
|
|
29
|
-
class ConfirmationDialog extends React.Component {
|
|
30
|
-
/** @hidden */
|
|
31
|
-
static defaultProps = {
|
|
32
|
-
cancelButtonText: 'Cancel',
|
|
33
|
-
confirmButtonText: 'Confirm',
|
|
34
|
-
isConfirmActionDangerous: false,
|
|
35
|
-
isCancelButtonDisabled: false,
|
|
36
|
-
isConfirmButtonDisabled: false,
|
|
37
|
-
width: '400px'
|
|
38
|
-
};
|
|
39
|
-
/** @internal */
|
|
40
|
-
_confirmButtonRef = /*#__PURE__*/React.createRef();
|
|
41
|
-
/** @hidden */
|
|
42
|
-
componentDidMount() {
|
|
43
|
-
if (this._confirmButtonRef.current !== null) {
|
|
44
|
-
this._confirmButtonRef.current.focus();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/** @hidden */
|
|
48
|
-
render() {
|
|
49
|
-
const {
|
|
50
|
-
title,
|
|
51
|
-
body,
|
|
52
|
-
cancelButtonText,
|
|
53
|
-
confirmButtonText,
|
|
54
|
-
isConfirmActionDangerous,
|
|
55
|
-
className,
|
|
56
|
-
style,
|
|
57
|
-
backgroundClassName,
|
|
58
|
-
backgroundStyle,
|
|
59
|
-
onCancel,
|
|
60
|
-
onConfirm,
|
|
61
|
-
isCancelButtonDisabled,
|
|
62
|
-
isConfirmButtonDisabled,
|
|
63
|
-
...restOfProps
|
|
64
|
-
} = this.props;
|
|
65
|
-
return /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
66
|
-
onClose: onCancel,
|
|
67
|
-
className: className,
|
|
68
|
-
style: style,
|
|
69
|
-
backgroundClassName: backgroundClassName,
|
|
70
|
-
backgroundStyle: backgroundStyle
|
|
71
|
-
}, restOfProps), /*#__PURE__*/React.createElement(Dialog.CloseButton, null), /*#__PURE__*/React.createElement(Heading, {
|
|
72
|
-
size: "small"
|
|
73
|
-
}, title), typeof body === 'string' ? /*#__PURE__*/React.createElement(Text, {
|
|
74
|
-
variant: "paragraph"
|
|
75
|
-
}, body) : body, /*#__PURE__*/React.createElement(Box, {
|
|
76
|
-
display: "flex",
|
|
77
|
-
flexDirection: "row-reverse",
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
justifyContent: "start",
|
|
80
|
-
width: "100%",
|
|
81
|
-
marginTop: 3
|
|
82
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
-
ref: this._confirmButtonRef,
|
|
84
|
-
onClick: onConfirm,
|
|
85
|
-
variant: isConfirmActionDangerous ? 'danger' : 'primary',
|
|
86
|
-
disabled: isConfirmButtonDisabled
|
|
87
|
-
}, confirmButtonText), /*#__PURE__*/React.createElement(Button, {
|
|
88
|
-
onClick: onCancel,
|
|
89
|
-
variant: "secondary",
|
|
90
|
-
alignSelf: "end",
|
|
91
|
-
marginRight: 2,
|
|
92
|
-
disabled: isCancelButtonDisabled
|
|
93
|
-
}, cancelButtonText)));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export default ConfirmationDialog;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui/system: Control sizes */ /** */
|
|
2
|
-
import { compose, system } from '@styled-system/core';
|
|
3
|
-
import { createEnum } from '../../shared/private_utils';
|
|
4
|
-
import useTheme from './theme/use_theme';
|
|
5
|
-
import getStylePropsForResponsiveProp from './system/utils/get_style_props_for_responsive_prop';
|
|
6
|
-
import useStyledSystem from './use_styled_system';
|
|
7
|
-
import { allStylesParser } from './system';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sizes for the {@link Button}, {@link Input}, {@link Select}, {@link SelectButtons}, and {@link Switch} components.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export const ControlSize = createEnum('small', 'default', 'large');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Size prop for the {@link Button}, {@link Input}, {@link Select}, {@link SelectButtons}, and {@link Switch} components.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export function useButtonSize(controlSizeProp) {
|
|
21
|
-
const {
|
|
22
|
-
buttonSizes
|
|
23
|
-
} = useTheme();
|
|
24
|
-
let styleProps;
|
|
25
|
-
if (typeof controlSizeProp === 'string') {
|
|
26
|
-
styleProps = buttonSizes[controlSizeProp];
|
|
27
|
-
} else {
|
|
28
|
-
styleProps = getStylePropsForResponsiveProp(controlSizeProp, buttonSizes);
|
|
29
|
-
}
|
|
30
|
-
return useStyledSystem(styleProps);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// For selects we create a custom style parser that includes `backgroundPosition`.
|
|
34
|
-
const selectSizeStyleParser = compose(allStylesParser, system({
|
|
35
|
-
backgroundPosition: true
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
/** @internal */
|
|
39
|
-
export function useSelectSize(controlSizeProp) {
|
|
40
|
-
const {
|
|
41
|
-
selectSizes
|
|
42
|
-
} = useTheme();
|
|
43
|
-
let styleProps;
|
|
44
|
-
if (typeof controlSizeProp === 'string') {
|
|
45
|
-
styleProps = selectSizes[controlSizeProp];
|
|
46
|
-
} else {
|
|
47
|
-
styleProps = getStylePropsForResponsiveProp(controlSizeProp, selectSizes);
|
|
48
|
-
}
|
|
49
|
-
return useStyledSystem(styleProps, selectSizeStyleParser);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** @internal */
|
|
53
|
-
export function useInputSize(controlSizeProp) {
|
|
54
|
-
const {
|
|
55
|
-
inputSizes
|
|
56
|
-
} = useTheme();
|
|
57
|
-
let styleProps;
|
|
58
|
-
if (typeof controlSizeProp === 'string') {
|
|
59
|
-
styleProps = inputSizes[controlSizeProp];
|
|
60
|
-
} else {
|
|
61
|
-
styleProps = getStylePropsForResponsiveProp(controlSizeProp, inputSizes);
|
|
62
|
-
}
|
|
63
|
-
return useStyledSystem(styleProps);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** @internal */
|
|
67
|
-
export function useSelectButtonsSize(controlSizeProp) {
|
|
68
|
-
const {
|
|
69
|
-
selectButtonsSizes
|
|
70
|
-
} = useTheme();
|
|
71
|
-
let styleProps;
|
|
72
|
-
if (typeof controlSizeProp === 'string') {
|
|
73
|
-
styleProps = selectButtonsSizes[controlSizeProp];
|
|
74
|
-
} else {
|
|
75
|
-
styleProps = getStylePropsForResponsiveProp(controlSizeProp, selectButtonsSizes);
|
|
76
|
-
}
|
|
77
|
-
return useStyledSystem(styleProps);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** @internal */
|
|
81
|
-
export function useSwitchSize(controlSizeProp) {
|
|
82
|
-
const {
|
|
83
|
-
switchSizes
|
|
84
|
-
} = useTheme();
|
|
85
|
-
let styleProps;
|
|
86
|
-
if (typeof controlSizeProp === 'string') {
|
|
87
|
-
styleProps = switchSizes[controlSizeProp];
|
|
88
|
-
} else {
|
|
89
|
-
styleProps = getStylePropsForResponsiveProp(controlSizeProp, switchSizes);
|
|
90
|
-
}
|
|
91
|
-
return useStyledSystem(styleProps);
|
|
92
|
-
}
|