@airtable/blocks 1.18.0 → 1.18.2
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/CHANGELOG.md +552 -0
- package/dist/cjs/color_utils.js +21 -23
- package/dist/cjs/colors.js +4 -60
- package/dist/cjs/error_utils.js +15 -25
- package/dist/cjs/event_tracker.js +5 -11
- package/dist/cjs/global_config.js +107 -188
- package/dist/cjs/index.js +16 -40
- package/dist/cjs/injected/airtable_interface.js +1 -6
- package/dist/cjs/models/abstract_model.js +50 -81
- package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
- package/dist/cjs/models/base.js +211 -374
- package/dist/cjs/models/create_aggregators.js +53 -47
- package/dist/cjs/models/cursor.js +125 -201
- package/dist/cjs/models/field.js +256 -303
- package/dist/cjs/models/grouped_record_query_result.js +210 -286
- package/dist/cjs/models/linked_records_query_result.js +276 -454
- package/dist/cjs/models/models.js +36 -50
- package/dist/cjs/models/mutation_constants.js +5 -9
- package/dist/cjs/models/mutations.js +125 -338
- package/dist/cjs/models/object_pool.js +37 -94
- package/dist/cjs/models/record.js +132 -226
- package/dist/cjs/models/record_coloring.js +14 -19
- package/dist/cjs/models/record_query_result.js +323 -282
- package/dist/cjs/models/record_store.js +355 -688
- package/dist/cjs/models/session.js +99 -158
- package/dist/cjs/models/table.js +361 -549
- package/dist/cjs/models/table_or_view_query_result.js +410 -765
- package/dist/cjs/models/view.js +161 -204
- package/dist/cjs/models/view_data_store.js +177 -282
- package/dist/cjs/models/view_metadata_query_result.js +96 -127
- package/dist/cjs/perform_record_action.js +69 -103
- package/dist/cjs/private_utils.js +133 -223
- package/dist/cjs/sdk.js +97 -142
- package/dist/cjs/settings_button.js +30 -57
- package/dist/cjs/stats/block_stats.js +3 -15
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
- package/dist/cjs/types/airtable_interface.js +36 -8
- package/dist/cjs/types/field.js +66 -12
- package/dist/cjs/types/mutations.js +99 -6
- package/dist/cjs/types/permission_levels.js +2 -4
- package/dist/cjs/types/undo_redo.js +2 -3
- package/dist/cjs/types/view.js +16 -11
- package/dist/cjs/ui/base_provider.js +14 -9
- package/dist/cjs/ui/baymax_utils.js +107 -1102
- package/dist/cjs/ui/block_wrapper.js +30 -68
- package/dist/cjs/ui/box.js +52 -56
- package/dist/cjs/ui/button.js +60 -77
- package/dist/cjs/ui/cell_renderer.js +78 -139
- package/dist/cjs/ui/choice_token.js +45 -47
- package/dist/cjs/ui/collaborator_token.js +33 -54
- package/dist/cjs/ui/color_palette.js +58 -106
- package/dist/cjs/ui/color_palette_synced.js +41 -52
- package/dist/cjs/ui/confirmation_dialog.js +53 -69
- package/dist/cjs/ui/control_sizes.js +21 -46
- package/dist/cjs/ui/create_detect_element_resize.js +16 -50
- package/dist/cjs/ui/css_helpers.js +3 -10
- package/dist/cjs/ui/dialog.js +44 -71
- package/dist/cjs/ui/dialog_close_button.js +52 -72
- package/dist/cjs/ui/expand_record.js +4 -11
- package/dist/cjs/ui/expand_record_list.js +6 -11
- package/dist/cjs/ui/expand_record_picker_async.js +18 -35
- package/dist/cjs/ui/field_icon.js +25 -28
- package/dist/cjs/ui/field_picker.js +47 -81
- package/dist/cjs/ui/field_picker_synced.js +33 -44
- package/dist/cjs/ui/form_field.js +45 -64
- package/dist/cjs/ui/geometry/geometry.js +6 -10
- package/dist/cjs/ui/geometry/point.js +5 -13
- package/dist/cjs/ui/geometry/rect.js +7 -29
- package/dist/cjs/ui/geometry/size.js +5 -13
- package/dist/cjs/ui/global_alert.js +35 -61
- package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
- package/dist/cjs/ui/heading.js +63 -92
- package/dist/cjs/ui/icon.js +44 -66
- package/dist/cjs/ui/icon_config.js +13 -24
- package/dist/cjs/ui/initialize_block.js +23 -36
- package/dist/cjs/ui/input.js +74 -87
- package/dist/cjs/ui/input_synced.js +34 -43
- package/dist/cjs/ui/key_codes.js +4 -9
- package/dist/cjs/ui/label.js +45 -50
- package/dist/cjs/ui/link.js +74 -89
- package/dist/cjs/ui/loader.js +26 -42
- package/dist/cjs/ui/modal.js +63 -89
- package/dist/cjs/ui/model_picker_select.js +29 -47
- package/dist/cjs/ui/popover.js +98 -180
- package/dist/cjs/ui/progress_bar.js +45 -51
- package/dist/cjs/ui/record_card.js +143 -278
- package/dist/cjs/ui/record_card_list.js +117 -165
- package/dist/cjs/ui/remote_utils.js +5 -13
- package/dist/cjs/ui/sdk_context.js +7 -9
- package/dist/cjs/ui/select.js +84 -118
- package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
- package/dist/cjs/ui/select_buttons.js +54 -90
- package/dist/cjs/ui/select_buttons_synced.js +32 -41
- package/dist/cjs/ui/select_synced.js +32 -42
- package/dist/cjs/ui/switch.js +66 -84
- package/dist/cjs/ui/switch_synced.js +32 -38
- package/dist/cjs/ui/synced.js +16 -43
- package/dist/cjs/ui/system/all_styles_set.js +89 -22
- package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
- package/dist/cjs/ui/system/appearance/background_color.js +6 -12
- package/dist/cjs/ui/system/appearance/border.js +6 -12
- package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
- package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
- package/dist/cjs/ui/system/appearance/opacity.js +5 -11
- package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
- package/dist/cjs/ui/system/dimensions/height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/width.js +5 -11
- package/dist/cjs/ui/system/display.js +8 -9
- package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
- package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
- package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
- package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
- package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
- package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
- package/dist/cjs/ui/system/flex_item/flex.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
- package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
- package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
- package/dist/cjs/ui/system/flex_item/order.js +5 -11
- package/dist/cjs/ui/system/index.js +310 -362
- package/dist/cjs/ui/system/overflow.js +8 -9
- package/dist/cjs/ui/system/position/bottom.js +6 -13
- package/dist/cjs/ui/system/position/left.js +5 -12
- package/dist/cjs/ui/system/position/position.js +5 -11
- package/dist/cjs/ui/system/position/position_set.js +15 -27
- package/dist/cjs/ui/system/position/right.js +5 -12
- package/dist/cjs/ui/system/position/top.js +5 -12
- package/dist/cjs/ui/system/position/z_index.js +5 -11
- package/dist/cjs/ui/system/spacing/margin.js +5 -12
- package/dist/cjs/ui/system/spacing/padding.js +5 -12
- package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
- package/dist/cjs/ui/system/typography/font_family.js +5 -11
- package/dist/cjs/ui/system/typography/font_size.js +5 -11
- package/dist/cjs/ui/system/typography/font_style.js +5 -11
- package/dist/cjs/ui/system/typography/font_weight.js +5 -11
- package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
- package/dist/cjs/ui/system/typography/line_height.js +5 -11
- package/dist/cjs/ui/system/typography/text_align.js +5 -11
- package/dist/cjs/ui/system/typography/text_color.js +5 -11
- package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
- package/dist/cjs/ui/system/typography/text_transform.js +5 -11
- package/dist/cjs/ui/system/typography/typography_set.js +15 -31
- package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
- package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
- package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
- package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
- package/dist/cjs/ui/table_picker.js +26 -43
- package/dist/cjs/ui/table_picker_synced.js +33 -42
- package/dist/cjs/ui/text.js +59 -71
- package/dist/cjs/ui/text_button.js +80 -97
- package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
- package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
- package/dist/cjs/ui/theme/default_theme/index.js +15 -32
- package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
- package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
- package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
- package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
- package/dist/cjs/ui/theme/theme_context.js +3 -6
- package/dist/cjs/ui/theme/use_theme.js +1 -7
- package/dist/cjs/ui/tooltip.js +38 -79
- package/dist/cjs/ui/types/aria_props.js +3 -7
- package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
- package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
- package/dist/cjs/ui/ui.js +89 -130
- package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
- package/dist/cjs/ui/use_array_identity.js +0 -4
- package/dist/cjs/ui/use_base.js +4 -13
- package/dist/cjs/ui/use_cursor.js +3 -12
- package/dist/cjs/ui/use_form_field.js +4 -6
- package/dist/cjs/ui/use_global_config.js +3 -10
- package/dist/cjs/ui/use_loadable.js +59 -132
- package/dist/cjs/ui/use_record_action_data.js +6 -12
- package/dist/cjs/ui/use_records.js +23 -24
- package/dist/cjs/ui/use_session.js +6 -15
- package/dist/cjs/ui/use_settings_button.js +4 -11
- package/dist/cjs/ui/use_styled_system.js +12 -21
- package/dist/cjs/ui/use_synced.js +0 -7
- package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
- package/dist/cjs/ui/use_view_metadata.js +5 -8
- package/dist/cjs/ui/use_viewport.js +1 -7
- package/dist/cjs/ui/use_watchable.js +36 -74
- package/dist/cjs/ui/view_picker.js +44 -78
- package/dist/cjs/ui/view_picker_synced.js +33 -44
- package/dist/cjs/ui/viewport_constraint.js +37 -64
- package/dist/cjs/ui/with_hooks.js +17 -22
- package/dist/cjs/ui/with_styled_system.js +33 -60
- package/dist/cjs/undo_redo.js +12 -32
- package/dist/cjs/unstable_private_utils.js +6 -8
- package/dist/cjs/unstable_testing_utils.js +44 -57
- package/dist/cjs/viewport.js +127 -189
- package/dist/cjs/warning.js +5 -6
- package/dist/cjs/watchable.js +66 -148
- package/dist/types/src/colors.d.ts +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +1 -1
- package/dist/types/src/global_config.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +1 -1
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +1 -1
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +1 -1
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/models.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +1 -1
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_coloring.d.ts +2 -2
- package/dist/types/src/models/record_coloring.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/session.d.ts +1 -1
- package/dist/types/src/models/session.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +1 -1
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +1 -1
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/perform_record_action.d.ts +1 -1
- package/dist/types/src/perform_record_action.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +8 -8
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/settings_button.d.ts.map +1 -1
- package/dist/types/src/types/aggregators.d.ts +1 -1
- package/dist/types/src/types/aggregators.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +6 -6
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/attachment.d.ts +1 -1
- package/dist/types/src/types/attachment.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -1
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/block.d.ts +1 -1
- package/dist/types/src/types/block.d.ts.map +1 -1
- package/dist/types/src/types/collaborator.d.ts +1 -1
- package/dist/types/src/types/collaborator.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +5 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/global_config.d.ts +6 -6
- package/dist/types/src/types/global_config.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +4 -4
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/permission_levels.d.ts +1 -1
- package/dist/types/src/types/permission_levels.d.ts.map +1 -1
- package/dist/types/src/types/record.d.ts +2 -2
- package/dist/types/src/types/record.d.ts.map +1 -1
- package/dist/types/src/types/record_action_data.d.ts +1 -1
- package/dist/types/src/types/record_action_data.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/undo_redo.d.ts +1 -1
- package/dist/types/src/types/undo_redo.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +4 -4
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/base_provider.d.ts +1 -1
- package/dist/types/src/ui/base_provider.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts +2 -2
- package/dist/types/src/ui/button.d.ts +1 -1
- package/dist/types/src/ui/button.d.ts.map +1 -1
- package/dist/types/src/ui/cell_renderer.d.ts +2 -2
- package/dist/types/src/ui/choice_token.d.ts +3 -3
- package/dist/types/src/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/ui/collaborator_token.d.ts +5 -5
- package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/ui/color_palette.d.ts +2 -2
- package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
- package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
- package/dist/types/src/ui/control_sizes.d.ts +2 -2
- package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/ui/dialog.d.ts +2 -2
- package/dist/types/src/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
- package/dist/types/src/ui/field_icon.d.ts +3 -3
- package/dist/types/src/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/ui/field_picker.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts.map +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/heading.d.ts +3 -3
- package/dist/types/src/ui/heading.d.ts.map +1 -1
- package/dist/types/src/ui/icon.d.ts +1 -1
- package/dist/types/src/ui/icon_config.d.ts +39 -39
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +3 -3
- package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/ui/input.d.ts +15 -15
- package/dist/types/src/ui/input.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/loader.d.ts +1 -1
- package/dist/types/src/ui/loader.d.ts.map +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/ui/popover.d.ts +5 -5
- package/dist/types/src/ui/popover.d.ts.map +1 -1
- package/dist/types/src/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +2 -2
- package/dist/types/src/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/ui/record_card_list.d.ts +1 -1
- package/dist/types/src/ui/select.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/select_buttons.d.ts +4 -4
- package/dist/types/src/ui/switch.d.ts +1 -1
- package/dist/types/src/ui/switch.d.ts.map +1 -1
- package/dist/types/src/ui/synced.d.ts +3 -3
- package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
- package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/ui/system/display.d.ts +0 -1
- package/dist/types/src/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
- package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/types.d.ts +4 -4
- package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
- package/dist/types/src/ui/text.d.ts +3 -3
- package/dist/types/src/ui/text.d.ts.map +1 -1
- package/dist/types/src/ui/text_button.d.ts +1 -1
- package/dist/types/src/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
- package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
- package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/ui/tooltip.d.ts +3 -3
- package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/ui/use_base.d.ts.map +1 -1
- package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
- package/dist/types/src/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
- package/dist/types/src/ui/use_records.d.ts +2 -2
- package/dist/types/src/ui/use_records.d.ts.map +1 -1
- package/dist/types/src/ui/use_session.d.ts.map +1 -1
- package/dist/types/src/ui/view_picker.d.ts +2 -2
- package/dist/types/src/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +2 -2
- package/dist/types/src/viewport.d.ts.map +1 -1
- package/dist/types/src/warning.d.ts +1 -1
- package/dist/types/src/warning.d.ts.map +1 -1
- package/dist/types/stories/helpers/code_block.d.ts +2 -2
- package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
- package/dist/types/stories/helpers/example.d.ts +5 -5
- package/dist/types/stories/helpers/example.d.ts.map +1 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
- package/dist/types/stories/icon_example.d.ts +2 -2
- package/dist/types/stories/icon_example.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/package.json +26 -25
package/dist/cjs/ui/switch.js
CHANGED
|
@@ -1,74 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
3
8
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.filter");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.includes");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
14
|
-
|
|
15
9
|
Object.defineProperty(exports, "__esModule", {
|
|
16
10
|
value: true
|
|
17
11
|
});
|
|
18
|
-
exports.
|
|
19
|
-
|
|
12
|
+
exports.switchStylePropTypes = exports.sharedSwitchPropTypes = exports.default = void 0;
|
|
13
|
+
require("core-js/modules/es.array.includes.js");
|
|
20
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
|
-
|
|
22
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
17
|
var _emotion = require("emotion");
|
|
27
|
-
|
|
28
18
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
19
|
var _core = require("@styled-system/core");
|
|
31
|
-
|
|
32
20
|
var _private_utils = require("../private_utils");
|
|
33
|
-
|
|
34
21
|
var _use_styled_system = _interopRequireDefault(require("./use_styled_system"));
|
|
35
|
-
|
|
36
22
|
var _system = require("./system");
|
|
37
|
-
|
|
38
23
|
var _tooltip_anchor_props = require("./types/tooltip_anchor_props");
|
|
39
|
-
|
|
40
24
|
var _use_theme = _interopRequireDefault(require("./theme/use_theme"));
|
|
41
|
-
|
|
42
25
|
var _control_sizes = require("./control_sizes");
|
|
43
|
-
|
|
44
|
-
function ownKeys(
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
var _excluded = ["disabled", "id", "label", "tabIndex", "variant", "size", "value", "onClick", "onChange", "onMouseEnter", "onMouseLeave", "className", "style", "aria-label", "aria-describedby", "aria-labelledby"];
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @module @airtable/blocks/ui: Switch */ /** */
|
|
29
|
+
/**
|
|
30
|
+
* Variants for the {@link Switch} component:
|
|
31
|
+
*
|
|
32
|
+
* • **default**
|
|
33
|
+
*
|
|
34
|
+
* Green switch for toggling a setting or other boolean property.
|
|
35
|
+
*
|
|
36
|
+
* • **danger**
|
|
37
|
+
*
|
|
38
|
+
* Red switch for toggling a dangerous or infrequently-used setting.
|
|
39
|
+
*/
|
|
47
40
|
|
|
48
41
|
var SwitchVariant = (0, _private_utils.createEnum)('default', 'danger');
|
|
49
42
|
var switchVariantPropType = (0, _private_utils.createPropTypeFromEnum)(SwitchVariant);
|
|
50
|
-
/** @internal */
|
|
51
43
|
|
|
44
|
+
/** @internal */
|
|
52
45
|
function useSwitchVariant() {
|
|
53
46
|
var variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SwitchVariant.default;
|
|
54
|
-
|
|
55
47
|
var _useTheme = (0, _use_theme.default)(),
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
switchVariants = _useTheme.switchVariants;
|
|
58
49
|
return switchVariants[variant];
|
|
59
50
|
}
|
|
51
|
+
|
|
60
52
|
/**
|
|
61
53
|
* Props shared between the {@link Switch} and {@link SwitchSynced} components.
|
|
62
54
|
*
|
|
63
55
|
* @noInheritDoc
|
|
64
56
|
*/
|
|
65
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Props for the {@link Switch} component. Also accepts:
|
|
60
|
+
* * {@link SwitchStyleProps}
|
|
61
|
+
*
|
|
62
|
+
* @docsPath UI/components/Switch
|
|
63
|
+
*/
|
|
66
64
|
|
|
67
|
-
var switchStylePropTypes = _objectSpread({}, _system.maxWidthPropTypes,
|
|
68
|
-
|
|
69
|
-
exports.switchStylePropTypes = switchStylePropTypes;
|
|
70
|
-
|
|
71
|
-
var sharedSwitchPropTypes = _objectSpread({
|
|
65
|
+
var switchStylePropTypes = exports.switchStylePropTypes = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _system.maxWidthPropTypes), _system.minWidthPropTypes), _system.widthPropTypes), _system.flexItemSetPropTypes), _system.positionSetPropTypes), _system.spacingSetPropTypes), _system.backgroundColorPropTypes), _system.displayPropTypes);
|
|
66
|
+
var sharedSwitchPropTypes = exports.sharedSwitchPropTypes = _objectSpread(_objectSpread({
|
|
72
67
|
disabled: _propTypes.default.bool,
|
|
73
68
|
id: _propTypes.default.string,
|
|
74
69
|
label: _propTypes.default.node,
|
|
@@ -80,7 +75,8 @@ var sharedSwitchPropTypes = _objectSpread({
|
|
|
80
75
|
'aria-label': _propTypes.default.string,
|
|
81
76
|
'aria-labelledby': _propTypes.default.string,
|
|
82
77
|
'aria-describedby': _propTypes.default.string
|
|
83
|
-
}, _tooltip_anchor_props.tooltipAnchorPropTypes,
|
|
78
|
+
}, _tooltip_anchor_props.tooltipAnchorPropTypes), switchStylePropTypes);
|
|
79
|
+
|
|
84
80
|
/**
|
|
85
81
|
* Style props for the {@link Switch} component. Also accepts:
|
|
86
82
|
* * {@link BackgroundColorProps}
|
|
@@ -94,9 +90,8 @@ var sharedSwitchPropTypes = _objectSpread({
|
|
|
94
90
|
* @noInheritDoc
|
|
95
91
|
*/
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
exports.sharedSwitchPropTypes = sharedSwitchPropTypes;
|
|
99
93
|
var styleParser = (0, _core.compose)(_system.maxWidth, _system.minWidth, _system.width, _system.flexItemSet, _system.positionSet, _system.spacingSet, _system.display, _system.backgroundColor);
|
|
94
|
+
|
|
100
95
|
/**
|
|
101
96
|
* A toggle switch for controlling boolean values. Similar to a checkbox.
|
|
102
97
|
*
|
|
@@ -110,75 +105,65 @@ var styleParser = (0, _core.compose)(_system.maxWidth, _system.minWidth, _system
|
|
|
110
105
|
* @docsPath UI/components/Switch
|
|
111
106
|
* @component
|
|
112
107
|
*/
|
|
113
|
-
|
|
114
108
|
var Switch = (props, ref) => {
|
|
115
109
|
var disabled = props.disabled,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
id = props.id,
|
|
111
|
+
label = props.label,
|
|
112
|
+
_props$tabIndex = props.tabIndex,
|
|
113
|
+
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
114
|
+
_props$variant = props.variant,
|
|
115
|
+
variant = _props$variant === void 0 ? SwitchVariant.default : _props$variant,
|
|
116
|
+
_props$size = props.size,
|
|
117
|
+
size = _props$size === void 0 ? _control_sizes.ControlSize.default : _props$size,
|
|
118
|
+
value = props.value,
|
|
119
|
+
onClick = props.onClick,
|
|
120
|
+
onChange = props.onChange,
|
|
121
|
+
onMouseEnter = props.onMouseEnter,
|
|
122
|
+
onMouseLeave = props.onMouseLeave,
|
|
123
|
+
className = props.className,
|
|
124
|
+
style = props.style,
|
|
125
|
+
ariaLabel = props['aria-label'],
|
|
126
|
+
ariaDescribedBy = props['aria-describedby'],
|
|
127
|
+
ariaLabelledBy = props['aria-labelledby'],
|
|
128
|
+
styleProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
135
129
|
var classNameForStyleProps = (0, _use_styled_system.default)(_objectSpread({
|
|
136
130
|
display: 'flex',
|
|
137
131
|
width: '100%'
|
|
138
132
|
}, styleProps), styleParser);
|
|
139
|
-
|
|
140
133
|
var _useSwitchVariant = useSwitchVariant(variant),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
classNameForVariant = _useSwitchVariant.baseClassName,
|
|
135
|
+
switchContainerClassName = _useSwitchVariant.switchContainerClassName,
|
|
136
|
+
switchClassName = _useSwitchVariant.switchClassName,
|
|
137
|
+
switchLabelClassName = _useSwitchVariant.switchLabelClassName;
|
|
146
138
|
var classNameForSize = (0, _control_sizes.useSwitchSize)(size);
|
|
147
|
-
|
|
148
139
|
if (!label && !ariaLabelledBy && !ariaLabel) {
|
|
149
140
|
// eslint-disable-next-line no-console
|
|
150
141
|
console.warn('<Switch> should be labeled using either the `label`, `ariaLabel`, or `ariaLabelledBy` prop');
|
|
151
142
|
}
|
|
152
|
-
|
|
153
143
|
function _onClick(e) {
|
|
154
144
|
// onClick should only be defined in the case of a tooltip
|
|
155
145
|
if (onClick) {
|
|
156
146
|
onClick(e);
|
|
157
147
|
}
|
|
158
|
-
|
|
159
148
|
_toggleValue();
|
|
160
149
|
}
|
|
161
|
-
|
|
162
150
|
function _onKeyDown(e) {
|
|
163
151
|
if (e.ctrlKey || e.altKey || e.metaKey) {
|
|
164
152
|
return;
|
|
165
153
|
}
|
|
166
|
-
|
|
167
154
|
if (['Enter', ' '].includes(e.key)) {
|
|
168
155
|
e.preventDefault();
|
|
169
|
-
|
|
170
156
|
_toggleValue();
|
|
171
157
|
}
|
|
172
158
|
}
|
|
173
|
-
|
|
174
159
|
function _toggleValue() {
|
|
175
160
|
if (onChange) {
|
|
176
161
|
onChange(!value);
|
|
177
162
|
}
|
|
178
163
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
164
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
165
|
+
ref: ref
|
|
166
|
+
// TODO (stephen): remove tooltip anchor props
|
|
182
167
|
,
|
|
183
168
|
onMouseEnter: onMouseEnter,
|
|
184
169
|
onMouseLeave: onMouseLeave,
|
|
@@ -194,20 +179,17 @@ var Switch = (props, ref) => {
|
|
|
194
179
|
"aria-label": ariaLabel,
|
|
195
180
|
"aria-labelledby": ariaLabelledBy,
|
|
196
181
|
"aria-describedby": ariaDescribedBy
|
|
197
|
-
}, _react.default.createElement("div", {
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
198
183
|
className: switchContainerClassName
|
|
199
|
-
}, _react.default.createElement("div", {
|
|
184
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
200
185
|
className: switchClassName
|
|
201
|
-
})), label && _react.default.createElement("label", {
|
|
186
|
+
})), label && /*#__PURE__*/_react.default.createElement("label", {
|
|
202
187
|
className: switchLabelClassName
|
|
203
188
|
}, label));
|
|
204
189
|
};
|
|
205
|
-
|
|
206
|
-
var ForwardedRefSwitch = _react.default.forwardRef(Switch);
|
|
207
|
-
|
|
190
|
+
var ForwardedRefSwitch = /*#__PURE__*/_react.default.forwardRef(Switch);
|
|
208
191
|
ForwardedRefSwitch.propTypes = _objectSpread({
|
|
209
192
|
value: _propTypes.default.bool.isRequired
|
|
210
193
|
}, sharedSwitchPropTypes);
|
|
211
194
|
ForwardedRefSwitch.displayName = 'Switch';
|
|
212
|
-
var _default = ForwardedRefSwitch;
|
|
213
|
-
exports.default = _default;
|
|
195
|
+
var _default = exports.default = ForwardedRefSwitch;
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
require("core-js/modules/es.weak-map.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
11
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.filter");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
14
|
-
|
|
15
12
|
Object.defineProperty(exports, "__esModule", {
|
|
16
13
|
value: true
|
|
17
14
|
});
|
|
18
15
|
exports.default = void 0;
|
|
19
|
-
|
|
20
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
17
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
23
|
-
|
|
24
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
25
|
-
|
|
26
19
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
27
|
-
|
|
28
20
|
var React = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
21
|
var _switch = _interopRequireWildcard(require("./switch"));
|
|
31
|
-
|
|
32
22
|
var _use_synced = _interopRequireDefault(require("./use_synced"));
|
|
33
|
-
|
|
34
23
|
var _global_config_synced_component_helpers = _interopRequireDefault(require("./global_config_synced_component_helpers"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function
|
|
24
|
+
var _excluded = ["disabled", "globalConfigKey", "onChange"];
|
|
25
|
+
/** @module @airtable/blocks/ui: Switch */
|
|
26
|
+
/** */
|
|
27
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
+
/**
|
|
32
|
+
* Props for the {@link SwitchSynced} component. Also accepts:
|
|
33
|
+
* * {@link SwitchStyleProps}
|
|
34
|
+
*
|
|
35
|
+
* @docsPath UI/components/SwitchSynced
|
|
36
|
+
* @groupPath UI/components/Switch
|
|
37
|
+
*/
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* A toggleable switch for controlling boolean values, synced with {@link GlobalConfig}. Similar to a checkbox.
|
|
@@ -48,22 +47,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
48
47
|
*/
|
|
49
48
|
var SwitchSynced = (props, ref) => {
|
|
50
49
|
var disabled = props.disabled,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
globalConfigKey = props.globalConfigKey,
|
|
51
|
+
_onChange = props.onChange,
|
|
52
|
+
restOfProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
55
53
|
var _useSynced = (0, _use_synced.default)(globalConfigKey),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return React.createElement(_switch.default, (0, _extends2.default)({}, restOfProps, {
|
|
54
|
+
_useSynced2 = (0, _slicedToArray2.default)(_useSynced, 3),
|
|
55
|
+
value = _useSynced2[0],
|
|
56
|
+
setValue = _useSynced2[1],
|
|
57
|
+
canSetValue = _useSynced2[2];
|
|
58
|
+
return /*#__PURE__*/React.createElement(_switch.default, (0, _extends2.default)({}, restOfProps, {
|
|
62
59
|
ref: ref,
|
|
63
60
|
value: !!value,
|
|
64
61
|
onChange: newValue => {
|
|
65
62
|
setValue(newValue);
|
|
66
|
-
|
|
67
63
|
if (_onChange) {
|
|
68
64
|
_onChange(newValue);
|
|
69
65
|
}
|
|
@@ -71,11 +67,9 @@ var SwitchSynced = (props, ref) => {
|
|
|
71
67
|
disabled: disabled || !canSetValue
|
|
72
68
|
}));
|
|
73
69
|
};
|
|
74
|
-
|
|
75
|
-
var ForwardedRefSwitchSynced = React.forwardRef(SwitchSynced);
|
|
70
|
+
var ForwardedRefSwitchSynced = /*#__PURE__*/React.forwardRef(SwitchSynced);
|
|
76
71
|
ForwardedRefSwitchSynced.propTypes = _objectSpread({
|
|
77
72
|
globalConfigKey: _global_config_synced_component_helpers.default.globalConfigKeyPropType
|
|
78
73
|
}, _switch.sharedSwitchPropTypes);
|
|
79
74
|
ForwardedRefSwitchSynced.displayName = 'SwitchSynced';
|
|
80
|
-
var _default = ForwardedRefSwitchSynced;
|
|
81
|
-
exports.default = _default;
|
|
75
|
+
var _default = exports.default = ForwardedRefSwitchSynced;
|
package/dist/cjs/ui/synced.js
CHANGED
|
@@ -1,69 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
require("core-js/modules/es.object.to-string.js");
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
7
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
8
|
Object.defineProperty(exports, "__esModule", {
|
|
8
9
|
value: true
|
|
9
10
|
});
|
|
10
11
|
exports.default = exports.Synced = void 0;
|
|
11
|
-
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
-
|
|
22
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
19
|
var React = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
20
|
var _global_config_synced_component_helpers = _interopRequireDefault(require("./global_config_synced_component_helpers"));
|
|
31
|
-
|
|
32
21
|
var _with_hooks = _interopRequireDefault(require("./with_hooks"));
|
|
33
|
-
|
|
34
22
|
var _sdk_context = require("./sdk_context");
|
|
35
|
-
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @hidden */ /** */
|
|
36
27
|
/** @hidden */
|
|
37
|
-
|
|
38
|
-
/** */
|
|
39
|
-
|
|
40
28
|
/** @hidden */
|
|
41
|
-
var Synced =
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
function (_React$Component) {
|
|
44
|
-
(0, _inherits2.default)(Synced, _React$Component);
|
|
45
|
-
|
|
46
|
-
/** @hidden */
|
|
47
|
-
|
|
29
|
+
var Synced = exports.Synced = /*#__PURE__*/function (_React$Component) {
|
|
48
30
|
/** @hidden */
|
|
49
31
|
function Synced(props) {
|
|
50
32
|
var _this;
|
|
51
|
-
|
|
52
33
|
(0, _classCallCheck2.default)(this, Synced);
|
|
53
|
-
_this = (
|
|
54
|
-
_this._setValue = _this._setValue.bind(
|
|
34
|
+
_this = _callSuper(this, Synced, [props]);
|
|
35
|
+
_this._setValue = _this._setValue.bind(_this);
|
|
55
36
|
return _this;
|
|
56
37
|
}
|
|
57
38
|
/** @internal */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(0, _createClass2.default)(Synced, [{
|
|
39
|
+
(0, _inherits2.default)(Synced, _React$Component);
|
|
40
|
+
return (0, _createClass2.default)(Synced, [{
|
|
61
41
|
key: "_setValue",
|
|
62
42
|
value: function _setValue(newValue) {
|
|
63
43
|
this.props.sdk.globalConfig.setAsync(this.props.globalConfigKey, newValue);
|
|
64
44
|
}
|
|
65
45
|
/** @hidden */
|
|
66
|
-
|
|
67
46
|
}, {
|
|
68
47
|
key: "render",
|
|
69
48
|
value: function render() {
|
|
@@ -77,21 +56,15 @@ function (_React$Component) {
|
|
|
77
56
|
});
|
|
78
57
|
}
|
|
79
58
|
}]);
|
|
80
|
-
return Synced;
|
|
81
59
|
}(React.Component);
|
|
82
|
-
|
|
83
|
-
exports.Synced = Synced;
|
|
60
|
+
/** @hidden */
|
|
84
61
|
(0, _defineProperty2.default)(Synced, "propTypes", {
|
|
85
62
|
globalConfigKey: _global_config_synced_component_helpers.default.globalConfigKeyPropType,
|
|
86
63
|
render: _propTypes.default.func.isRequired
|
|
87
64
|
});
|
|
88
|
-
|
|
89
|
-
var _default = (0, _with_hooks.default)(Synced, props => {
|
|
65
|
+
var _default = exports.default = (0, _with_hooks.default)(Synced, props => {
|
|
90
66
|
_global_config_synced_component_helpers.default.useDefaultWatchesForSyncedComponent(props.globalConfigKey);
|
|
91
|
-
|
|
92
67
|
return {
|
|
93
68
|
sdk: (0, _sdk_context.useSdk)()
|
|
94
69
|
};
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
exports.default = _default;
|
|
70
|
+
});
|
|
@@ -1,33 +1,100 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
3
8
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.filter");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
12
|
-
|
|
13
9
|
Object.defineProperty(exports, "__esModule", {
|
|
14
10
|
value: true
|
|
15
11
|
});
|
|
16
12
|
exports.allStylesPropTypes = exports.allStylesParser = void 0;
|
|
17
|
-
|
|
18
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
14
|
var _core = require("@styled-system/core");
|
|
21
|
-
|
|
22
15
|
var _index = require("./index");
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @module @airtable/blocks/ui/system: All style props */ /** */
|
|
18
|
+
/**
|
|
19
|
+
* In the Blocks SDK, UI components can be styled via a set of supported style props.
|
|
20
|
+
* These style props (e.g. `width`, `margin`, `backgroundColor`) take a subset of
|
|
21
|
+
* supported CSS properties and expose them as explicit React component props.
|
|
22
|
+
*
|
|
23
|
+
* Here is an example that uses the {@link Box} layout primitive:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* <Box
|
|
27
|
+
* display="flex"
|
|
28
|
+
* alignItems="center"
|
|
29
|
+
* justifyContent="center"
|
|
30
|
+
* width="200px"
|
|
31
|
+
* height="200px"
|
|
32
|
+
* >
|
|
33
|
+
* Hello world
|
|
34
|
+
* </Box>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* This is equivalent to the following:
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
* <div style={{
|
|
41
|
+
* display: 'flex',
|
|
42
|
+
* alignItems: 'center',
|
|
43
|
+
* justifyContent: 'center',
|
|
44
|
+
* width: '200px',
|
|
45
|
+
* height: '200px',
|
|
46
|
+
* }}>
|
|
47
|
+
* Hello world
|
|
48
|
+
* </div>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Style props also provide access to Airtable's design tokens, including our color
|
|
52
|
+
* palette, typographic scale, and spacing scale. This allows developers to quickly
|
|
53
|
+
* build UIs that adhere to the Airtable design system. As an example, numbers passed
|
|
54
|
+
* to the `margin` or `padding` props are converted to our spacing scale, based on
|
|
55
|
+
* powers of two.
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
58
|
+
* <Box margin={0} /> // margin: 0;
|
|
59
|
+
* <Box margin={1} /> // margin: 4px;
|
|
60
|
+
* <Box margin={2} /> // margin: 8px;
|
|
61
|
+
* <Box margin={3} /> // margin: 16px;
|
|
62
|
+
*
|
|
63
|
+
* // Negative margins are also supported
|
|
64
|
+
* <Box margin={-1} /> // margin: -4px;
|
|
65
|
+
* <Box margin={-2} /> // margin: -8px;
|
|
66
|
+
* <Box margin={-3} /> // margin: -16px;
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* To override this behavior and use a specific pixel value (or other units, like percentages
|
|
70
|
+
* or ems/rems), you may pass a string like `200px`. However, this is generally discouraged,
|
|
71
|
+
* as these values don't adhere to the same grid/vertical rhythm as the rest of our components.
|
|
72
|
+
*
|
|
73
|
+
* As another example, style props like `backgroundColor` and `textColor` accept
|
|
74
|
+
* {@link Colors|color names} that ensure visual consistency with the Airtable styleguide.
|
|
75
|
+
* Like the spacing scale, you can always opt out by passing in hex/rgb/hsl strings directly.
|
|
76
|
+
*
|
|
77
|
+
* ```
|
|
78
|
+
* <Box backgroundColor="blue" textColor="white" />
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* Each component in our UI library exposes a particular subset of style props, documented as
|
|
82
|
+
* style prop interfaces. For more information, refer to the API reference for the specific
|
|
83
|
+
* component that you're trying to use.
|
|
84
|
+
*
|
|
85
|
+
* All supported style props:
|
|
86
|
+
* * {@link AppearanceSetProps|Appearance}
|
|
87
|
+
* * {@link DimensionsSetProps|Dimensions}
|
|
88
|
+
* * {@link FlexContainerSetProps|Flex container}
|
|
89
|
+
* * {@link FlexItemSetProps|Flex item}
|
|
90
|
+
* * {@link PositionSetProps|Position}
|
|
91
|
+
* * {@link SpacingSetProps|Spacing}
|
|
92
|
+
* * {@link TypographySetProps|Typography}
|
|
93
|
+
* * {@link DisplayProps|Display}
|
|
94
|
+
* * {@link OverflowProps|Overflow}
|
|
95
|
+
*
|
|
96
|
+
* @docsPath UI/Style System/All styles
|
|
97
|
+
*/
|
|
23
98
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
-
|
|
28
|
-
var allStylesParser = (0, _core.compose)(_index.appearanceSet, _index.dimensionsSet, _index.flexContainerSet, _index.flexItemSet, _index.positionSet, _index.spacingSet, _index.typographySet, _index.display, _index.overflow);
|
|
29
|
-
exports.allStylesParser = allStylesParser;
|
|
30
|
-
|
|
31
|
-
var allStylesPropTypes = _objectSpread({}, _index.appearanceSetPropTypes, {}, _index.dimensionsSetPropTypes, {}, _index.flexContainerSetPropTypes, {}, _index.flexItemSetPropTypes, {}, _index.positionSetPropTypes, {}, _index.spacingSetPropTypes, {}, _index.typographySetPropTypes, {}, _index.displayPropTypes, {}, _index.overflowPropTypes);
|
|
32
|
-
|
|
33
|
-
exports.allStylesPropTypes = allStylesPropTypes;
|
|
99
|
+
var allStylesParser = exports.allStylesParser = (0, _core.compose)(_index.appearanceSet, _index.dimensionsSet, _index.flexContainerSet, _index.flexItemSet, _index.positionSet, _index.spacingSet, _index.typographySet, _index.display, _index.overflow);
|
|
100
|
+
var allStylesPropTypes = exports.allStylesPropTypes = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _index.appearanceSetPropTypes), _index.dimensionsSetPropTypes), _index.flexContainerSetPropTypes), _index.flexItemSetPropTypes), _index.positionSetPropTypes), _index.spacingSetPropTypes), _index.typographySetPropTypes), _index.displayPropTypes), _index.overflowPropTypes);
|