@airtable/blocks 0.0.0-experimental-3e47d4d04-20250909 → 0.0.0-experimental-446b49015-20251008
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/models/base.js +1 -35
- 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/models/base.js +0 -5
- package/dist/esm/interface/models/record_store.js +3 -0
- 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/models/base_core.js +18 -3
- 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/models/base.d.ts.map +1 -1
- 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/types/base.d.ts +0 -1
- package/dist/types/src/base/types/base.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/models/base.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/models/base_core.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/types/base_core.d.ts +1 -0
- package/dist/types/src/shared/types/base_core.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,152 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: Input */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { compose } from '@styled-system/core';
|
|
5
|
-
import { createEnum } from '../../shared/private_utils';
|
|
6
|
-
import useTheme from './theme/use_theme';
|
|
7
|
-
import useStyledSystem from './use_styled_system';
|
|
8
|
-
import useFormField from './use_form_field';
|
|
9
|
-
import { maxWidth, minWidth, width, flexItemSet, positionSet, margin } from './system';
|
|
10
|
-
import { ControlSize, useInputSize } from './control_sizes';
|
|
11
|
-
|
|
12
|
-
/** @internal */
|
|
13
|
-
|
|
14
|
-
const InputVariant = createEnum('default');
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
function useInputVariant() {
|
|
18
|
-
let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : InputVariant.default;
|
|
19
|
-
const {
|
|
20
|
-
inputVariants
|
|
21
|
-
} = useTheme();
|
|
22
|
-
return inputVariants[variant];
|
|
23
|
-
}
|
|
24
|
-
export const ValidInputType = createEnum('date', 'datetime-local', 'email', 'month', 'number', 'password', 'search', 'tel', 'text', 'time', 'url', 'week');
|
|
25
|
-
/** */
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Style props shared between the {@link Input} and {@link InputSynced} components. Accepts:
|
|
29
|
-
* * {@link FlexItemSetProps}
|
|
30
|
-
* * {@link MarginProps}
|
|
31
|
-
* * {@link MaxWidthProps}
|
|
32
|
-
* * {@link MinWidthProps}
|
|
33
|
-
* * {@link PositionSetProps}
|
|
34
|
-
* * {@link WidthProps}
|
|
35
|
-
*
|
|
36
|
-
* @noInheritDoc
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
const styleParser = compose(maxWidth, minWidth, width, flexItemSet, positionSet, margin);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Props shared between the {@link Input} and {@link InputSynced} components.
|
|
43
|
-
*
|
|
44
|
-
* @noInheritDoc
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
export const SupportedInputType = createEnum('date', 'datetime-local', 'email', 'month', 'number', 'password', 'search', 'tel', 'text', 'time', 'url', 'week');
|
|
48
|
-
/**
|
|
49
|
-
* Supported types for the {@link Input} component. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types) for more information.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Props for the {@link Input} component. Also accepts:
|
|
54
|
-
* * {@link InputStyleProps}
|
|
55
|
-
*
|
|
56
|
-
* @docsPath UI/components/Input
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* An input component. A wrapper around `<input>` that fits in with Airtable's user interface.
|
|
61
|
-
*
|
|
62
|
-
* [[ Story id="input--example" title="Input example" ]]
|
|
63
|
-
*
|
|
64
|
-
* @docsPath UI/components/Input
|
|
65
|
-
* @component
|
|
66
|
-
*/
|
|
67
|
-
const Input = (props, ref) => {
|
|
68
|
-
const {
|
|
69
|
-
size = ControlSize.default,
|
|
70
|
-
type = SupportedInputType.text,
|
|
71
|
-
value,
|
|
72
|
-
placeholder,
|
|
73
|
-
onMouseEnter,
|
|
74
|
-
onMouseLeave,
|
|
75
|
-
onClick,
|
|
76
|
-
// This hasOnClick prop is set by the Tooltip wrapper. Destructure it here just to get it out of `props`.
|
|
77
|
-
// See 7a80fefd0a0bc871c31e0c063662c6100b0ca77d
|
|
78
|
-
// TODO(stephen): clean this up.
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
-
hasOnClick,
|
|
81
|
-
onChange,
|
|
82
|
-
onBlur,
|
|
83
|
-
onFocus,
|
|
84
|
-
style,
|
|
85
|
-
className,
|
|
86
|
-
disabled,
|
|
87
|
-
required,
|
|
88
|
-
spellCheck,
|
|
89
|
-
tabIndex,
|
|
90
|
-
id,
|
|
91
|
-
name,
|
|
92
|
-
autoFocus,
|
|
93
|
-
max,
|
|
94
|
-
maxLength,
|
|
95
|
-
min,
|
|
96
|
-
minLength,
|
|
97
|
-
step,
|
|
98
|
-
pattern,
|
|
99
|
-
readOnly,
|
|
100
|
-
autoComplete,
|
|
101
|
-
'aria-labelledby': ariaLabelledBy,
|
|
102
|
-
'aria-describedby': ariaDescribedByProp,
|
|
103
|
-
...styleProps
|
|
104
|
-
} = props;
|
|
105
|
-
const formFieldContextValue = useFormField();
|
|
106
|
-
const controlId = formFieldContextValue ? formFieldContextValue.controlId : undefined;
|
|
107
|
-
const descriptionId = formFieldContextValue ? formFieldContextValue.descriptionId : undefined;
|
|
108
|
-
const ariaDescribedBy = [ariaDescribedByProp, descriptionId].filter(Boolean).join(' ') || undefined;
|
|
109
|
-
// There is only a single default variant.
|
|
110
|
-
const classNameForInputVariant = useInputVariant();
|
|
111
|
-
const classNameForInputSize = useInputSize(size);
|
|
112
|
-
const classNameForStyleProps = useStyledSystem({
|
|
113
|
-
width: '100%',
|
|
114
|
-
...styleProps
|
|
115
|
-
}, styleParser);
|
|
116
|
-
return /*#__PURE__*/React.createElement("input", {
|
|
117
|
-
ref: ref,
|
|
118
|
-
value: value,
|
|
119
|
-
type: type,
|
|
120
|
-
placeholder: placeholder,
|
|
121
|
-
disabled: disabled,
|
|
122
|
-
required: required,
|
|
123
|
-
spellCheck: spellCheck,
|
|
124
|
-
tabIndex: tabIndex,
|
|
125
|
-
id: id || controlId,
|
|
126
|
-
name: name,
|
|
127
|
-
autoFocus: autoFocus,
|
|
128
|
-
max: max,
|
|
129
|
-
maxLength: maxLength,
|
|
130
|
-
min: min,
|
|
131
|
-
minLength: minLength,
|
|
132
|
-
step: step,
|
|
133
|
-
pattern: pattern,
|
|
134
|
-
readOnly: readOnly,
|
|
135
|
-
autoComplete: autoComplete,
|
|
136
|
-
onChange: onChange,
|
|
137
|
-
onBlur: onBlur,
|
|
138
|
-
onFocus: onFocus
|
|
139
|
-
// TODO (stephen): remove tooltip anchor props
|
|
140
|
-
,
|
|
141
|
-
onMouseEnter: onMouseEnter,
|
|
142
|
-
onMouseLeave: onMouseLeave,
|
|
143
|
-
onClick: onClick,
|
|
144
|
-
style: style,
|
|
145
|
-
className: cx(classNameForInputSize, classNameForInputVariant, classNameForStyleProps, className),
|
|
146
|
-
"aria-labelledby": ariaLabelledBy,
|
|
147
|
-
"aria-describedby": ariaDescribedBy
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
const ForwardedRefInput = /*#__PURE__*/React.forwardRef(Input);
|
|
151
|
-
ForwardedRefInput.displayName = 'Input';
|
|
152
|
-
export default ForwardedRefInput;
|
|
@@ -1,59 +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: Input */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { spawnError } from '../../shared/error_utils';
|
|
5
|
-
import useSynced from '../../shared/ui/use_synced';
|
|
6
|
-
import Input, { SupportedInputType } from './input';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Props for the {@link InputSynced} component. Also accepts:
|
|
10
|
-
* * {@link InputStyleProps}
|
|
11
|
-
*
|
|
12
|
-
* @docsPath UI/components/InputSynced
|
|
13
|
-
* @groupPath UI/components/Input
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A wrapper around the {@link Input} component that syncs with {@link GlobalConfig}.
|
|
18
|
-
*
|
|
19
|
-
* [[ Story id="input--example-synced" title="Synced input example" ]]
|
|
20
|
-
*
|
|
21
|
-
* @docsPath UI/components/InputSynced
|
|
22
|
-
* @groupPath UI/components/Input
|
|
23
|
-
* @component
|
|
24
|
-
*/
|
|
25
|
-
const InputSynced = (props, ref) => {
|
|
26
|
-
const {
|
|
27
|
-
globalConfigKey,
|
|
28
|
-
type = SupportedInputType.text,
|
|
29
|
-
disabled,
|
|
30
|
-
onChange,
|
|
31
|
-
...restOfProps
|
|
32
|
-
} = props;
|
|
33
|
-
const [value, setValue, canSetValue] = useSynced(globalConfigKey);
|
|
34
|
-
let inputValue;
|
|
35
|
-
if (value === null || value === undefined) {
|
|
36
|
-
// If an input gets null or undefined for value, React treats it as uncontrolled
|
|
37
|
-
// and will throw warnings when it becomes controlled.
|
|
38
|
-
inputValue = '';
|
|
39
|
-
} else if (typeof value === 'string') {
|
|
40
|
-
inputValue = value;
|
|
41
|
-
} else {
|
|
42
|
-
throw spawnError('InputSynced only works with a global config value that is a string, null or undefined.');
|
|
43
|
-
}
|
|
44
|
-
return /*#__PURE__*/React.createElement(Input, _extends({}, restOfProps, {
|
|
45
|
-
ref: ref,
|
|
46
|
-
disabled: disabled || !canSetValue,
|
|
47
|
-
onChange: e => {
|
|
48
|
-
setValue(e.target.value);
|
|
49
|
-
if (onChange) {
|
|
50
|
-
onChange(e);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
value: inputValue,
|
|
54
|
-
type: type
|
|
55
|
-
}));
|
|
56
|
-
};
|
|
57
|
-
const ForwardedRefInputSynced = /*#__PURE__*/React.forwardRef(InputSynced);
|
|
58
|
-
ForwardedRefInputSynced.displayName = 'InputSynced';
|
|
59
|
-
export default ForwardedRefInputSynced;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export const KeyCodes = Object.freeze({
|
|
5
|
-
BACKSPACE: 8,
|
|
6
|
-
TAB: 9,
|
|
7
|
-
ENTER: 13,
|
|
8
|
-
ALT: 18,
|
|
9
|
-
ESCAPE: 27,
|
|
10
|
-
SPACE: 32,
|
|
11
|
-
PAGE_UP: 33,
|
|
12
|
-
PAGE_DOWN: 34,
|
|
13
|
-
END: 35,
|
|
14
|
-
HOME: 36,
|
|
15
|
-
LEFT: 37,
|
|
16
|
-
UP: 38,
|
|
17
|
-
RIGHT: 39,
|
|
18
|
-
DOWN: 40,
|
|
19
|
-
DELETE: 46,
|
|
20
|
-
A: 65,
|
|
21
|
-
B: 66,
|
|
22
|
-
C: 67,
|
|
23
|
-
D: 68,
|
|
24
|
-
E: 69,
|
|
25
|
-
F: 70,
|
|
26
|
-
G: 71,
|
|
27
|
-
H: 72,
|
|
28
|
-
I: 73,
|
|
29
|
-
J: 74,
|
|
30
|
-
K: 75,
|
|
31
|
-
L: 76,
|
|
32
|
-
M: 77,
|
|
33
|
-
N: 78,
|
|
34
|
-
O: 79,
|
|
35
|
-
P: 80,
|
|
36
|
-
Q: 81,
|
|
37
|
-
R: 82,
|
|
38
|
-
S: 83,
|
|
39
|
-
T: 84,
|
|
40
|
-
U: 85,
|
|
41
|
-
V: 86,
|
|
42
|
-
W: 87,
|
|
43
|
-
X: 88,
|
|
44
|
-
Y: 89,
|
|
45
|
-
Z: 90,
|
|
46
|
-
F2: 113,
|
|
47
|
-
F3: 114,
|
|
48
|
-
COMMA: 188,
|
|
49
|
-
PERIOD: 190,
|
|
50
|
-
FORWARD_SLASH: 191,
|
|
51
|
-
BACKTICK: 192,
|
|
52
|
-
BACK_SLASH: 220
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @internal
|
|
57
|
-
* OS-aware check for command/ctrl key.
|
|
58
|
-
*/
|
|
59
|
-
export function isCommandModifierKeyEvent(e) {
|
|
60
|
-
const isMac = window.navigator.platform.toLowerCase().indexOf('mac') !== -1;
|
|
61
|
-
if (isMac) {
|
|
62
|
-
return e.metaKey;
|
|
63
|
-
} else {
|
|
64
|
-
return e.ctrlKey;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,73 +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: Label */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { cx } from 'emotion';
|
|
5
|
-
import useStyledSystem from './use_styled_system';
|
|
6
|
-
import { allStylesParser } from './system/index';
|
|
7
|
-
import { TextSize, useTextStyle } from './text';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Props for the {@link Label} component. Also accepts:
|
|
11
|
-
* * {@link AllStylesProps}
|
|
12
|
-
* * {@link AriaProps}
|
|
13
|
-
*
|
|
14
|
-
* @noInheritDoc
|
|
15
|
-
* @docsPath UI/components/Label
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A label component.
|
|
20
|
-
*
|
|
21
|
-
* [[ Story id="label--example" title="Label example" ]]
|
|
22
|
-
*
|
|
23
|
-
* @docsPath UI/components/Label
|
|
24
|
-
* @component
|
|
25
|
-
*/
|
|
26
|
-
const Label = (props, ref) => {
|
|
27
|
-
const {
|
|
28
|
-
size = TextSize.default,
|
|
29
|
-
htmlFor,
|
|
30
|
-
id,
|
|
31
|
-
children,
|
|
32
|
-
className,
|
|
33
|
-
style,
|
|
34
|
-
dataAttributes,
|
|
35
|
-
role,
|
|
36
|
-
'aria-label': ariaLabel,
|
|
37
|
-
'aria-labelledby': ariaLabelledBy,
|
|
38
|
-
'aria-describedby': ariaDescribedBy,
|
|
39
|
-
'aria-controls': ariaControls,
|
|
40
|
-
'aria-expanded': ariaExpanded,
|
|
41
|
-
'aria-haspopup': ariaHasPopup,
|
|
42
|
-
'aria-hidden': ariaHidden,
|
|
43
|
-
'aria-live': ariaLive,
|
|
44
|
-
...styleProps
|
|
45
|
-
} = props;
|
|
46
|
-
const classNameForTextStyle = useTextStyle(size);
|
|
47
|
-
const classNameForStyleProps = useStyledSystem({
|
|
48
|
-
display: 'inline-block',
|
|
49
|
-
textColor: 'light',
|
|
50
|
-
fontWeight: 'strong',
|
|
51
|
-
marginBottom: '6px',
|
|
52
|
-
...styleProps
|
|
53
|
-
}, allStylesParser);
|
|
54
|
-
return /*#__PURE__*/React.createElement("label", _extends({
|
|
55
|
-
ref: ref,
|
|
56
|
-
htmlFor: htmlFor,
|
|
57
|
-
id: id,
|
|
58
|
-
className: cx(classNameForTextStyle, classNameForStyleProps, className),
|
|
59
|
-
style: style,
|
|
60
|
-
role: role,
|
|
61
|
-
"aria-label": ariaLabel,
|
|
62
|
-
"aria-labelledby": ariaLabelledBy,
|
|
63
|
-
"aria-describedby": ariaDescribedBy,
|
|
64
|
-
"aria-controls": ariaControls,
|
|
65
|
-
"aria-expanded": ariaExpanded,
|
|
66
|
-
"aria-haspopup": ariaHasPopup,
|
|
67
|
-
"aria-hidden": ariaHidden,
|
|
68
|
-
"aria-live": ariaLive
|
|
69
|
-
}, dataAttributes), children);
|
|
70
|
-
};
|
|
71
|
-
const ForwardedRefLabel = /*#__PURE__*/React.forwardRef(Label);
|
|
72
|
-
ForwardedRefLabel.displayName = 'Label';
|
|
73
|
-
export default ForwardedRefLabel;
|
package/dist/esm/base/ui/link.js
DELETED
|
@@ -1,189 +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: Link */ /** */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { cx } from 'emotion';
|
|
5
|
-
import { compose } from '@styled-system/core';
|
|
6
|
-
import { createEnum } from '../../shared/private_utils';
|
|
7
|
-
import useStyledSystem from './use_styled_system';
|
|
8
|
-
import useTheme from './theme/use_theme';
|
|
9
|
-
import { maxWidth, minWidth, width, flexItemSet, positionSet, fontWeight, spacingSet, display } from './system';
|
|
10
|
-
import { useTextStyle, TextSize } from './text';
|
|
11
|
-
import Icon from './icon';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Style props for the {@link Link} component. Also accepts:
|
|
15
|
-
* * {@link FlexItemSetProps}
|
|
16
|
-
* * {@link FontWeightProps}
|
|
17
|
-
* * {@link MaxWidthProps}
|
|
18
|
-
* * {@link MinWidthProps}
|
|
19
|
-
* * {@link PositionSetProps}
|
|
20
|
-
* * {@link SpacingSetProps}
|
|
21
|
-
* * {@link WidthProps}
|
|
22
|
-
*
|
|
23
|
-
* @noInheritDoc
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const styleParser = compose(display, maxWidth, minWidth, width, flexItemSet, positionSet, fontWeight, spacingSet);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Variants for the {@link Link} component:
|
|
30
|
-
*
|
|
31
|
-
* • **default**
|
|
32
|
-
*
|
|
33
|
-
* Blue text.
|
|
34
|
-
*
|
|
35
|
-
* • **dark**
|
|
36
|
-
*
|
|
37
|
-
* Dark gray text.
|
|
38
|
-
*
|
|
39
|
-
* • **light**
|
|
40
|
-
*
|
|
41
|
-
* Light gray text.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
const LinkVariant = createEnum('default', 'dark', 'light');
|
|
45
|
-
|
|
46
|
-
/** @internal */
|
|
47
|
-
function useLinkVariant() {
|
|
48
|
-
let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LinkVariant.default;
|
|
49
|
-
const {
|
|
50
|
-
linkVariants
|
|
51
|
-
} = useTheme();
|
|
52
|
-
return linkVariants[variant];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Props for the {@link Link} component. Also supports:
|
|
57
|
-
* * {@link AriaProps}
|
|
58
|
-
* * {@link LinkStyleProps}
|
|
59
|
-
*
|
|
60
|
-
* @docsPath UI/components/Link
|
|
61
|
-
* @noInheritDoc
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
// A "reasonable" scheme is one which does not have any escaped characters.
|
|
65
|
-
// This means if it passes this regex, we can confidently check to make sure the
|
|
66
|
-
// scheme is not "javascript://" to avoid XSS. Otherwise, "javascript" may be encoded
|
|
67
|
-
// as "javascript://" or any other permutation of escaped characters.
|
|
68
|
-
// Ref: https://tools.ietf.org/html/rfc3986#section-3.1
|
|
69
|
-
const reasonableUrlSchemeRegex = /^[a-z0-9]+:\/\//i;
|
|
70
|
-
|
|
71
|
-
/** @internal */
|
|
72
|
-
function _getSanitizedHref(href) {
|
|
73
|
-
if (!href) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
const hasScheme = href.indexOf('://') !== -1;
|
|
77
|
-
if (!hasScheme) {
|
|
78
|
-
// If it's a relative URL (like '/foo'), leave it alone.
|
|
79
|
-
return href;
|
|
80
|
-
} else if (reasonableUrlSchemeRegex.test(href) && !/^javascript:/i.test(href) && !/^data:/i.test(href)) {
|
|
81
|
-
// If it has a scheme and we can be 100% sure the scheme is
|
|
82
|
-
// not javascript or data, then leave it alone.
|
|
83
|
-
return href;
|
|
84
|
-
} else {
|
|
85
|
-
// We can't be confident that the scheme isn't javascript or data,
|
|
86
|
-
// (possibly with escaped characters), so prepend http:// to avoid
|
|
87
|
-
// XSS.
|
|
88
|
-
return 'http://' + href;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A styled link component with security benefits.
|
|
94
|
-
*
|
|
95
|
-
* [[ Story id="link--example" title="Link example" ]]
|
|
96
|
-
*
|
|
97
|
-
* ## Security benefits
|
|
98
|
-
*
|
|
99
|
-
* This component is a styled wrapper around the `<a>` tag that offers a few security benefits:
|
|
100
|
-
*
|
|
101
|
-
* - Limited XSS protection. If the `href` starts with `javascript:` or `data:`, `http://` will be prepended.
|
|
102
|
-
* - There is [reverse tabnabbing prevention](https://www.owasp.org/index.php/Reverse_Tabnabbing). If `target` is set, the `rel` attribute will be set to `noopener noreferrer`.
|
|
103
|
-
*
|
|
104
|
-
* Developers should use `Link` instead of `a` when possible.
|
|
105
|
-
*
|
|
106
|
-
* @docsPath UI/components/Link
|
|
107
|
-
* @component
|
|
108
|
-
*/
|
|
109
|
-
const Link = (props, ref) => {
|
|
110
|
-
const {
|
|
111
|
-
size = TextSize.default,
|
|
112
|
-
variant = LinkVariant.default,
|
|
113
|
-
underline = false,
|
|
114
|
-
icon,
|
|
115
|
-
href,
|
|
116
|
-
id,
|
|
117
|
-
target,
|
|
118
|
-
onMouseEnter,
|
|
119
|
-
onMouseLeave,
|
|
120
|
-
onClick,
|
|
121
|
-
// This hasOnClick prop is set by the Tooltip wrapper. Destructure it here just to get it out of `props`.
|
|
122
|
-
// See 7a80fefd0a0bc871c31e0c063662c6100b0ca77d
|
|
123
|
-
// TODO(stephen): clean this up.
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
125
|
-
hasOnClick,
|
|
126
|
-
tabIndex,
|
|
127
|
-
className,
|
|
128
|
-
style,
|
|
129
|
-
children,
|
|
130
|
-
dataAttributes,
|
|
131
|
-
'aria-label': ariaLabel,
|
|
132
|
-
'aria-labelledby': ariaLabelledBy,
|
|
133
|
-
'aria-describedby': ariaDescribedBy,
|
|
134
|
-
'aria-controls': ariaControls,
|
|
135
|
-
'aria-expanded': ariaExpanded,
|
|
136
|
-
'aria-haspopup': ariaHasPopup,
|
|
137
|
-
'aria-hidden': ariaHidden,
|
|
138
|
-
'aria-live': ariaLive,
|
|
139
|
-
...styleProps
|
|
140
|
-
} = props;
|
|
141
|
-
const classNameForTextStyle = useTextStyle(size);
|
|
142
|
-
const classNameForLinkVariant = useLinkVariant(variant);
|
|
143
|
-
const classNameForUnderline = useStyledSystem({
|
|
144
|
-
textDecoration: underline ? 'underline' : 'none'
|
|
145
|
-
});
|
|
146
|
-
const classNameForStyleProps = useStyledSystem({
|
|
147
|
-
display: 'inline-flex',
|
|
148
|
-
// Use a negative margin to undo the padding.
|
|
149
|
-
padding: '0 0.1em',
|
|
150
|
-
margin: '0 -0.1em',
|
|
151
|
-
maxWidth: '100%',
|
|
152
|
-
...styleProps
|
|
153
|
-
}, styleParser);
|
|
154
|
-
|
|
155
|
-
// Set rel="noopener noreferrer" to avoid reverse tabnabbing.
|
|
156
|
-
// https://www.owasp.org/index.php/Reverse_Tabnabbing
|
|
157
|
-
const rel = target ? 'noopener noreferrer' : undefined;
|
|
158
|
-
return /*#__PURE__*/React.createElement("a", _extends({
|
|
159
|
-
ref: ref,
|
|
160
|
-
href: _getSanitizedHref(href),
|
|
161
|
-
target: target,
|
|
162
|
-
id: id,
|
|
163
|
-
rel: rel
|
|
164
|
-
// TODO (stephen): remove tooltip anchor props
|
|
165
|
-
,
|
|
166
|
-
onMouseEnter: onMouseEnter,
|
|
167
|
-
onMouseLeave: onMouseLeave,
|
|
168
|
-
onClick: onClick,
|
|
169
|
-
tabIndex: tabIndex,
|
|
170
|
-
className: cx(classNameForTextStyle, classNameForLinkVariant, classNameForUnderline, classNameForStyleProps, className),
|
|
171
|
-
style: style,
|
|
172
|
-
"aria-label": ariaLabel,
|
|
173
|
-
"aria-labelledby": ariaLabelledBy,
|
|
174
|
-
"aria-describedby": ariaDescribedBy,
|
|
175
|
-
"aria-controls": ariaControls,
|
|
176
|
-
"aria-expanded": ariaExpanded,
|
|
177
|
-
"aria-haspopup": ariaHasPopup,
|
|
178
|
-
"aria-hidden": ariaHidden,
|
|
179
|
-
"aria-live": ariaLive
|
|
180
|
-
}, dataAttributes), typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
181
|
-
name: icon,
|
|
182
|
-
size: "1em",
|
|
183
|
-
flex: "none",
|
|
184
|
-
marginRight: "0.5em"
|
|
185
|
-
}) : icon, children);
|
|
186
|
-
};
|
|
187
|
-
const ForwardedRefLink = /*#__PURE__*/React.forwardRef(Link);
|
|
188
|
-
ForwardedRefLink.displayName = 'Link';
|
|
189
|
-
export default ForwardedRefLink;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** @module @airtable/blocks/ui: Loader */ /** */
|
|
2
|
-
import { cx } from 'emotion';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { compose } from '@styled-system/core';
|
|
5
|
-
import LoaderCore from '../../shared/ui/loader';
|
|
6
|
-
import { baymax } from './baymax_utils';
|
|
7
|
-
import useStyledSystem from './use_styled_system';
|
|
8
|
-
import { flexItemSet, positionSet, margin } from './system';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Style props for the {@link Loader} component. Accepts:
|
|
12
|
-
* * {@link FlexItemSetProps}
|
|
13
|
-
* * {@link MarginProps}
|
|
14
|
-
* * {@link PositionSetProps}
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const styleParser = compose(flexItemSet, positionSet, margin);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Props for the {@link Loader} component. Also accepts:
|
|
21
|
-
* * {@link LoaderStyleProps}
|
|
22
|
-
*
|
|
23
|
-
* @docsPath UI/components/Loader
|
|
24
|
-
* @noInheritDoc
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
// Override the default props and then just proxy through to our loader.
|
|
28
|
-
/**
|
|
29
|
-
* A loading spinner component.
|
|
30
|
-
*
|
|
31
|
-
* [[ Story id="loader--example" title="Loader example" ]]
|
|
32
|
-
*
|
|
33
|
-
* @docsPath UI/components/Loader
|
|
34
|
-
* @component
|
|
35
|
-
*/
|
|
36
|
-
const Loader = _ref => {
|
|
37
|
-
let {
|
|
38
|
-
fillColor = '#888',
|
|
39
|
-
scale = 0.3,
|
|
40
|
-
className,
|
|
41
|
-
style,
|
|
42
|
-
...styleProps
|
|
43
|
-
} = _ref;
|
|
44
|
-
const classNameForStyleProps = useStyledSystem(styleProps, styleParser);
|
|
45
|
-
return /*#__PURE__*/React.createElement(LoaderCore, {
|
|
46
|
-
fillColor: fillColor,
|
|
47
|
-
scale: scale,
|
|
48
|
-
className: cx(baymax('animate-spin-scale animate-infinite'), classNameForStyleProps, className),
|
|
49
|
-
style: style
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export default Loader;
|