@airtable/blocks 0.0.0-experimental-20e3506bd-20250428 → 0.0.0-experimental-f1c9010b3-20250609
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 +561 -0
- package/dist/cjs/base/models/base.js +1 -1
- package/dist/cjs/base/models/create_aggregators.js +1 -1
- package/dist/cjs/base/models/cursor.js +2 -2
- package/dist/cjs/base/models/field.js +2 -2
- package/dist/cjs/base/models/record_coloring.js +2 -2
- package/dist/cjs/base/models/record_query_result.js +1 -1
- package/dist/cjs/base/models/session.js +4 -4
- package/dist/cjs/base/models/table.js +2 -2
- package/dist/cjs/base/models/view.js +1 -1
- package/dist/cjs/base/perform_record_action.js +1 -1
- package/dist/cjs/base/sdk.js +4 -1
- package/dist/cjs/base/settings_button.js +2 -2
- package/dist/cjs/base/types/view.js +1 -1
- package/dist/cjs/base/ui/base_provider.js +1 -1
- package/dist/cjs/base/ui/expand_record.js +1 -1
- package/dist/cjs/base/ui/expand_record_list.js +1 -1
- package/dist/cjs/base/ui/expand_record_picker_async.js +1 -1
- package/dist/cjs/base/ui/global_alert.js +1 -1
- package/dist/cjs/base/ui/initialize_block.js +20 -5
- package/dist/cjs/base/ui/progress_bar.js +1 -1
- package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +2 -0
- package/dist/cjs/base/ui/system/utils/ensure_numbers_are_within_scale.js +2 -0
- package/dist/cjs/base/ui/ui.js +9 -1
- package/dist/cjs/base/ui/use_base.js +1 -1
- package/dist/cjs/base/ui/use_cursor.js +1 -1
- package/dist/cjs/{shared → base}/ui/use_loadable.js +6 -6
- package/dist/cjs/base/ui/use_record_action_data.js +2 -2
- package/dist/cjs/base/ui/use_records.js +5 -5
- package/dist/cjs/base/ui/use_session.js +1 -1
- package/dist/cjs/base/ui/use_settings_button.js +1 -1
- package/dist/cjs/base/ui/use_view_metadata.js +2 -2
- package/dist/cjs/base/ui/use_viewport.js +1 -1
- package/dist/cjs/base/ui/viewport_constraint.js +2 -2
- package/dist/cjs/base/viewport.js +1 -1
- package/dist/cjs/interface/models/models.js +53 -0
- package/dist/cjs/interface/models/table.js +45 -0
- package/dist/cjs/interface/sdk.js +0 -15
- package/dist/cjs/interface/ui/expand_record.js +2 -1
- package/dist/cjs/interface/ui/initialize_block.js +16 -4
- package/dist/cjs/interface/ui/ui.js +27 -8
- package/dist/cjs/interface/ui/use_custom_properties.js +52 -5
- package/dist/cjs/shared/colors.js +2 -2
- package/dist/cjs/shared/global_config.js +45 -40
- package/dist/cjs/shared/models/base_core.js +34 -11
- package/dist/cjs/shared/models/field_core.js +1 -1
- package/dist/cjs/shared/models/record_core.js +1 -1
- package/dist/cjs/shared/models/session_core.js +1 -1
- package/dist/cjs/shared/models/table_core.js +1 -1
- package/dist/cjs/shared/sdk_core.js +6 -6
- package/dist/cjs/shared/types/field.js +1 -1
- package/dist/cjs/shared/ui/remote_utils.js +3 -3
- package/dist/cjs/shared/ui/use_color_scheme.js +60 -0
- package/dist/cjs/shared/ui/use_global_config.js +13 -8
- package/dist/cjs/shared/ui/use_synced.js +1 -1
- package/dist/cjs/shared/ui/use_watchable.js +3 -22
- package/dist/cjs/shared/ui/with_hooks.js +3 -3
- package/dist/types/src/base/models/base.d.ts +1 -1
- package/dist/types/src/base/models/create_aggregators.d.ts +1 -1
- package/dist/types/src/base/models/cursor.d.ts +2 -2
- package/dist/types/src/base/models/field.d.ts +2 -2
- package/dist/types/src/base/models/record_coloring.d.ts +2 -2
- package/dist/types/src/base/models/record_query_result.d.ts +1 -1
- package/dist/types/src/base/models/session.d.ts +4 -4
- package/dist/types/src/base/models/table.d.ts +2 -2
- package/dist/types/src/base/models/view.d.ts +1 -1
- package/dist/types/src/base/perform_record_action.d.ts +1 -1
- package/dist/types/src/base/sdk.d.ts.map +1 -1
- package/dist/types/src/base/settings_button.d.ts +2 -2
- package/dist/types/src/base/types/view.d.ts +1 -1
- package/dist/types/src/base/ui/base_provider.d.ts +1 -1
- package/dist/types/src/base/ui/expand_record.d.ts +1 -1
- package/dist/types/src/base/ui/expand_record_list.d.ts +1 -1
- package/dist/types/src/base/ui/expand_record_picker_async.d.ts +1 -1
- package/dist/types/src/base/ui/global_alert.d.ts +1 -1
- package/dist/types/src/base/ui/initialize_block.d.ts +1 -1
- package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/base/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +1 -0
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/base/ui/ui.d.ts +2 -1
- package/dist/types/src/base/ui/ui.d.ts.map +1 -1
- package/dist/types/src/base/ui/use_base.d.ts +1 -1
- package/dist/types/src/base/ui/use_cursor.d.ts +1 -1
- package/dist/types/src/{shared → base}/ui/use_loadable.d.ts +3 -3
- package/dist/types/src/base/ui/use_loadable.d.ts.map +1 -0
- package/dist/types/src/base/ui/use_record_action_data.d.ts +1 -1
- package/dist/types/src/base/ui/use_session.d.ts +1 -1
- package/dist/types/src/base/ui/use_settings_button.d.ts +1 -1
- package/dist/types/src/base/ui/use_viewport.d.ts +1 -1
- package/dist/types/src/base/ui/viewport_constraint.d.ts +2 -2
- package/dist/types/src/base/viewport.d.ts +1 -1
- package/dist/types/src/interface/models/models.d.ts +8 -0
- package/dist/types/src/interface/models/models.d.ts.map +1 -0
- package/dist/types/src/interface/models/table.d.ts +30 -0
- package/dist/types/src/interface/models/table.d.ts.map +1 -1
- package/dist/types/src/interface/sdk.d.ts.map +1 -1
- package/dist/types/src/interface/types/table.d.ts +1 -0
- package/dist/types/src/interface/types/table.d.ts.map +1 -1
- package/dist/types/src/interface/ui/expand_record.d.ts +2 -1
- package/dist/types/src/interface/ui/expand_record.d.ts.map +1 -1
- package/dist/types/src/interface/ui/initialize_block.d.ts +30 -0
- package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/interface/ui/ui.d.ts +2 -1
- package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
- package/dist/types/src/interface/ui/use_custom_properties.d.ts +52 -5
- package/dist/types/src/interface/ui/use_custom_properties.d.ts.map +1 -1
- package/dist/types/src/shared/color_utils.d.ts +3 -3
- package/dist/types/src/shared/colors.d.ts +2 -2
- package/dist/types/src/shared/global_config.d.ts +45 -40
- package/dist/types/src/shared/global_config.d.ts.map +1 -1
- package/dist/types/src/shared/models/base_core.d.ts +34 -11
- package/dist/types/src/shared/models/base_core.d.ts.map +1 -1
- package/dist/types/src/shared/models/field_core.d.ts +1 -1
- package/dist/types/src/shared/models/session_core.d.ts +1 -1
- package/dist/types/src/shared/private_utils.d.ts +1 -1
- package/dist/types/src/shared/private_utils.d.ts.map +1 -1
- package/dist/types/src/shared/sdk_core.d.ts +4 -4
- package/dist/types/src/shared/types/field.d.ts +1 -1
- package/dist/types/src/shared/ui/remote_utils.d.ts +3 -3
- package/dist/types/src/shared/ui/use_color_scheme.d.ts +28 -0
- package/dist/types/src/shared/ui/use_color_scheme.d.ts.map +1 -0
- package/dist/types/src/shared/ui/use_global_config.d.ts +13 -8
- package/dist/types/src/shared/ui/use_global_config.d.ts.map +1 -1
- package/dist/types/src/shared/ui/use_synced.d.ts +1 -1
- package/dist/types/src/shared/ui/use_watchable.d.ts +3 -22
- package/dist/types/src/shared/ui/use_watchable.d.ts.map +1 -1
- package/dist/types/src/shared/ui/with_hooks.d.ts +3 -3
- package/dist/types/stories/collaborator_token.stories.d.ts.map +1 -1
- package/dist/types/test/ui/use_color_scheme.test.d.ts +2 -0
- package/dist/types/test/ui/use_color_scheme.test.d.ts.map +1 -0
- package/package.json +16 -12
- package/dist/types/src/shared/ui/use_loadable.d.ts.map +0 -1
- package/ui.d.ts +0 -1
- package/ui.js +0 -1
- package/unstable_private_utils.d.ts +0 -1
- package/unstable_private_utils.js +0 -1
- package/unstable_standalone_ui.d.ts +0 -1
- package/unstable_standalone_ui.js +0 -1
- package/unstable_testing_utils.d.ts +0 -1
- package/unstable_testing_utils.js +0 -1
|
@@ -2,8 +2,25 @@ import { Table } from '../models/table';
|
|
|
2
2
|
import { Base } from '../models/base';
|
|
3
3
|
import { Field } from '../models/field';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* An object that represents a custom property that a block can set.
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* type BlockPageElementCustomProperty = {key: string; label: string} & (
|
|
9
|
+
* | {type: 'boolean'; defaultValue: boolean}
|
|
10
|
+
* | {type: 'string'; defaultValue?: string}
|
|
11
|
+
* | {
|
|
12
|
+
* type: 'enum';
|
|
13
|
+
* possibleValues: Array<{value: string; label: string}>;
|
|
14
|
+
* defaultValue?: string;
|
|
15
|
+
* }
|
|
16
|
+
* | {
|
|
17
|
+
* type: 'field';
|
|
18
|
+
* table: Table;
|
|
19
|
+
* possibleValues?: Array<Field>; // If not provided, all visible fields in the table will be shown in the dropdown.
|
|
20
|
+
* defaultValue?: Field;
|
|
21
|
+
* }
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
7
24
|
*/
|
|
8
25
|
type BlockPageElementCustomProperty = {
|
|
9
26
|
key: string;
|
|
@@ -29,9 +46,39 @@ type BlockPageElementCustomProperty = {
|
|
|
29
46
|
defaultValue?: Field;
|
|
30
47
|
});
|
|
31
48
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
49
|
+
* A hook for integrating configuration settings for your block with the Interface Designer properties
|
|
50
|
+
* panel. Under the hood, this uses {@link GlobalConfig} to store the custom property values.
|
|
51
|
+
*
|
|
52
|
+
* Returns an object with:
|
|
53
|
+
* - `customPropertyValueByKey`: an object mapping custom property keys to their current value.
|
|
54
|
+
* - `errorState`: an object with an `error` property if there was an error setting the custom properties
|
|
55
|
+
*
|
|
56
|
+
* @param getCustomProperties A function that returns an array of {@link BlockPageElementCustomProperty}.
|
|
57
|
+
* This function should have a stable identity, so it should either be defined at the top level of the
|
|
58
|
+
* file or wrapped in useCallback. It will receive an instance of {@link Base} as an argument.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```js
|
|
62
|
+
* import {useCustomProperties} from '@airtable/blocks/interface/ui';
|
|
63
|
+
*
|
|
64
|
+
* function getCustomProperties(base: Base) {
|
|
65
|
+
* const table = base.tables[0];
|
|
66
|
+
* const numberFields = table.fields.filter(field => field.type === FieldType.NUMBER);
|
|
67
|
+
* return [
|
|
68
|
+
* {key: 'title', label: 'Title', type: 'string', defaultValue: 'Chart'},
|
|
69
|
+
* {key: 'xAxis', label: 'X-axis', type: 'field', table, possibleValues: numberFields},
|
|
70
|
+
* {key: 'yAxis', label: 'Y-axis', type: 'field', table, possibleValues: numberFields},
|
|
71
|
+
* {key: 'color', label: 'Color', type: 'enum', possibleValues: ['red', 'blue', 'green'], defaultValue: 'red'},
|
|
72
|
+
* {key: 'showLegend', label: 'Show Legend', type: 'boolean', defaultValue: true},
|
|
73
|
+
* ];
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* function MyApp() {
|
|
77
|
+
* const {customPropertyValueByKey, errorState} = useCustomProperties(getCustomProperties);
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
* @docsPath UI/hooks/useCustomProperties
|
|
81
|
+
* @hook
|
|
35
82
|
*/
|
|
36
83
|
export declare function useCustomProperties(getCustomProperties: (base: Base) => Array<BlockPageElementCustomProperty>): {
|
|
37
84
|
customPropertyValueByKey: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_custom_properties.d.ts","sourceRoot":"","sources":["../../../../../src/interface/ui/use_custom_properties.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CA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AAC,CAkDzF"}
|
|
@@ -20,7 +20,7 @@ interface ColorUtils {
|
|
|
20
20
|
* @param colorString
|
|
21
21
|
* @example
|
|
22
22
|
* ```js
|
|
23
|
-
* import {colorUtils, colors} from '@airtable/blocks/ui';
|
|
23
|
+
* import {colorUtils, colors} from '@airtable/blocks/[placeholder-path]/ui';
|
|
24
24
|
*
|
|
25
25
|
* colorUtils.getHexForColor(colors.RED);
|
|
26
26
|
* // => '#ef3061'
|
|
@@ -38,7 +38,7 @@ interface ColorUtils {
|
|
|
38
38
|
* @param colorString
|
|
39
39
|
* @example
|
|
40
40
|
* ```js
|
|
41
|
-
* import {colorUtils, colors} from '@airtable/blocks/ui';
|
|
41
|
+
* import {colorUtils, colors} from '@airtable/blocks/[placeholder-path]/ui';
|
|
42
42
|
*
|
|
43
43
|
* colorUtils.getRgbForColor(colors.PURPLE_DARK_1);
|
|
44
44
|
* // => {r: 107, g: 28, b: 176}
|
|
@@ -56,7 +56,7 @@ interface ColorUtils {
|
|
|
56
56
|
* @param colorString
|
|
57
57
|
* @example
|
|
58
58
|
* ```js
|
|
59
|
-
* import {colorUtils, colors} from '@airtable/blocks/ui';
|
|
59
|
+
* import {colorUtils, colors} from '@airtable/blocks/[placeholder-path]/ui';
|
|
60
60
|
*
|
|
61
61
|
* colorUtils.shouldUseLightTextOnColor(colors.PINK_LIGHT_1);
|
|
62
62
|
* // => false
|
|
@@ -10,9 +10,9 @@ import { ObjectValues } from './private_utils';
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```js
|
|
13
|
-
* import {
|
|
13
|
+
* import {colors, colorUtils} from '@airtable/blocks/[placeholder-path]/ui';
|
|
14
14
|
*
|
|
15
|
-
* <
|
|
15
|
+
* <div style={{backgroundColor: colorUtils.getHexForColor(colors.BLUE)}}>Hello world</div>
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @docsPath UI/utils/colors
|
|
@@ -21,10 +21,6 @@ type WatchableGlobalConfigKey = string;
|
|
|
21
21
|
* The maximum allowed size for a given GlobalConfig instance is 150kB.
|
|
22
22
|
* The maximum number of keys for a given GlobalConfig instance is 1000.
|
|
23
23
|
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* import {globalConfig} from '@airtable/blocks';
|
|
27
|
-
* ```
|
|
28
24
|
* @docsPath models/GlobalConfig
|
|
29
25
|
*/
|
|
30
26
|
declare class GlobalConfig extends Watchable<WatchableGlobalConfigKey> {
|
|
@@ -36,10 +32,13 @@ declare class GlobalConfig extends Watchable<WatchableGlobalConfigKey> {
|
|
|
36
32
|
* @param key A string for the top-level key, or an array of strings describing the path to the value.
|
|
37
33
|
* @example
|
|
38
34
|
* ```js
|
|
39
|
-
* import {
|
|
35
|
+
* import {useGlobalConfig} from '@airtable/blocks/[placeholder-path]/ui';
|
|
40
36
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* function MyApp() {
|
|
38
|
+
* const globalConfig = useGlobalConfig();
|
|
39
|
+
* const topLevelValue = globalConfig.get('topLevelKey');
|
|
40
|
+
* const nestedValue = globalConfig.get(['topLevelKey', 'nested', 'deeply']);
|
|
41
|
+
* }
|
|
43
42
|
* ```
|
|
44
43
|
*/
|
|
45
44
|
get(key: GlobalConfigKey): unknown;
|
|
@@ -115,23 +114,26 @@ declare class GlobalConfig extends Watchable<WatchableGlobalConfigKey> {
|
|
|
115
114
|
* @param value The value to set at the specified path. Use `undefined` to delete the value at the given path.
|
|
116
115
|
* @example
|
|
117
116
|
* ```js
|
|
118
|
-
* import {
|
|
119
|
-
*
|
|
120
|
-
* function
|
|
121
|
-
*
|
|
122
|
-
*
|
|
117
|
+
* import {useGlobalConfig} from '@airtable/blocks/[placeholder-path]/ui';
|
|
118
|
+
*
|
|
119
|
+
* function MyApp() {
|
|
120
|
+
* const globalConfig = useGlobalConfig();
|
|
121
|
+
* const updateFavoriteColorIfPossible = (color) => {
|
|
122
|
+
* if (globalConfig.hasPermissionToSet('favoriteColor', color)) {
|
|
123
|
+
* globalConfig.setAsync('favoriteColor', color);
|
|
124
|
+
* }
|
|
125
|
+
* // The update is now applied within your extension (eg will be
|
|
126
|
+
* // reflected in globalConfig) but are still being saved to
|
|
127
|
+
* // Airtable servers (e.g. may not be updated for other users yet)
|
|
123
128
|
* }
|
|
124
|
-
* // The update is now applied within your extension (eg will be
|
|
125
|
-
* // reflected in globalConfig) but are still being saved to
|
|
126
|
-
* // Airtable servers (e.g. may not be updated for other users yet)
|
|
127
|
-
* }
|
|
128
129
|
*
|
|
129
|
-
* async
|
|
130
|
-
*
|
|
131
|
-
*
|
|
130
|
+
* const updateFavoriteColorIfPossibleAsync = async (color) => {
|
|
131
|
+
* if (globalConfig.hasPermissionToSet('favoriteColor', color)) {
|
|
132
|
+
* await globalConfig.setAsync('favoriteColor', color);
|
|
133
|
+
* }
|
|
134
|
+
* // globalConfig updates have been saved to Airtable servers.
|
|
135
|
+
* alert('favoriteColor has been updated');
|
|
132
136
|
* }
|
|
133
|
-
* // globalConfig updates have been saved to Airtable servers.
|
|
134
|
-
* alert('favoriteColor has been updated');
|
|
135
137
|
* }
|
|
136
138
|
* ```
|
|
137
139
|
*/
|
|
@@ -204,28 +206,31 @@ declare class GlobalConfig extends Watchable<WatchableGlobalConfigKey> {
|
|
|
204
206
|
* @param updates The paths and values to set.
|
|
205
207
|
* @example
|
|
206
208
|
* ```js
|
|
207
|
-
* import {
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* ]
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
209
|
+
* import {useGlobalConfig} from '@airtable/blocks/[placeholder-path]/ui';
|
|
210
|
+
*
|
|
211
|
+
* function MyApp() {
|
|
212
|
+
* const globalConfig = useGlobalConfig();
|
|
213
|
+
* const updates = [
|
|
214
|
+
* {path: ['topLevelKey1', 'nestedKey1'], value: 'foo'},
|
|
215
|
+
* {path: ['topLevelKey2', 'nestedKey2'], value: 'bar'},
|
|
216
|
+
* ];
|
|
217
|
+
*
|
|
218
|
+
* const applyUpdatesIfPossible = () => {
|
|
219
|
+
* if (globalConfig.hasPermissionToSetPaths(updates)) {
|
|
220
|
+
* globalConfig.setPathsAsync(updates);
|
|
221
|
+
* }
|
|
222
|
+
* // The updates are now applied within your extension (eg will be reflected in
|
|
223
|
+
* // globalConfig) but are still being saved to Airtable servers (e.g. they
|
|
224
|
+
* // may not be updated for other users yet)
|
|
217
225
|
* }
|
|
218
|
-
* // The updates are now applied within your extension (eg will be reflected in
|
|
219
|
-
* // globalConfig) but are still being saved to Airtable servers (e.g. they
|
|
220
|
-
* // may not be updated for other users yet)
|
|
221
|
-
* }
|
|
222
226
|
*
|
|
223
|
-
* async
|
|
224
|
-
*
|
|
225
|
-
*
|
|
227
|
+
* const applyUpdatesIfPossibleAsync = async () => {
|
|
228
|
+
* if (globalConfig.hasPermissionToSetPaths(updates)) {
|
|
229
|
+
* await globalConfig.setPathsAsync(updates);
|
|
230
|
+
* }
|
|
231
|
+
* // globalConfig updates have been saved to Airtable servers.
|
|
232
|
+
* alert('globalConfig has been updated');
|
|
226
233
|
* }
|
|
227
|
-
* // globalConfig updates have been saved to Airtable servers.
|
|
228
|
-
* alert('globalConfig has been updated');
|
|
229
234
|
* }
|
|
230
235
|
* ```
|
|
231
236
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_config.d.ts","sourceRoot":"","sources":["../../../../src/shared/global_config.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAEH,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EAEjB,kBAAkB,EAClB,yBAAyB,EAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,qBAAqB,EAAoB,MAAM,wBAAwB,CAAC;AAKhF;;GAEG;AACH,KAAK,wBAAwB,GAAG,MAAM,CAAC;AASvC
|
|
1
|
+
{"version":3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C,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAiDzE;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -25,8 +25,12 @@ export declare abstract class BaseCore<SdkModeT extends SdkMode> extends Abstrac
|
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```js
|
|
28
|
-
* import {
|
|
29
|
-
*
|
|
28
|
+
* import {useBase} from '@airtable/blocks/[placeholder-path]/ui';
|
|
29
|
+
*
|
|
30
|
+
* function MyApp() {
|
|
31
|
+
* const base = useBase();
|
|
32
|
+
* console.log('The name of your base is', base.name);
|
|
33
|
+
* }
|
|
30
34
|
* ```
|
|
31
35
|
*/
|
|
32
36
|
get name(): string;
|
|
@@ -35,8 +39,12 @@ export declare abstract class BaseCore<SdkModeT extends SdkMode> extends Abstrac
|
|
|
35
39
|
*
|
|
36
40
|
* @example
|
|
37
41
|
* ```js
|
|
38
|
-
* import {
|
|
39
|
-
*
|
|
42
|
+
* import {useBase} from '@airtable/blocks/[placeholder-path]/ui';
|
|
43
|
+
*
|
|
44
|
+
* function MyApp() {
|
|
45
|
+
* const base = useBase();
|
|
46
|
+
* console.log('The workspace id of your base is', base.workspaceId);
|
|
47
|
+
* }
|
|
40
48
|
* ```
|
|
41
49
|
*/
|
|
42
50
|
get workspaceId(): string;
|
|
@@ -45,9 +53,16 @@ export declare abstract class BaseCore<SdkModeT extends SdkMode> extends Abstrac
|
|
|
45
53
|
*
|
|
46
54
|
* @example
|
|
47
55
|
* ```js
|
|
48
|
-
* import {
|
|
49
|
-
*
|
|
50
|
-
*
|
|
56
|
+
* import {colorUtils, useBase} from '@airtable/blocks/[placeholder-path]/ui';
|
|
57
|
+
*
|
|
58
|
+
* function MyApp() {
|
|
59
|
+
* const base = useBase();
|
|
60
|
+
* return (
|
|
61
|
+
* <div style={{backgroundColor: colorUtils.getHexForColor(base.color)}}>
|
|
62
|
+
* This div's background is the same color as the base background
|
|
63
|
+
* </div>
|
|
64
|
+
* );
|
|
65
|
+
* }
|
|
51
66
|
* ```
|
|
52
67
|
*/
|
|
53
68
|
get color(): string;
|
|
@@ -56,8 +71,12 @@ export declare abstract class BaseCore<SdkModeT extends SdkMode> extends Abstrac
|
|
|
56
71
|
*
|
|
57
72
|
* @example
|
|
58
73
|
* ```js
|
|
59
|
-
* import {
|
|
60
|
-
*
|
|
74
|
+
* import {useBase} from '@airtable/blocks/[placeholder-path]/ui';
|
|
75
|
+
*
|
|
76
|
+
* function MyApp() {
|
|
77
|
+
* const base = useBase();
|
|
78
|
+
* console.log(`You have ${base.tables.length} tables`);
|
|
79
|
+
* }
|
|
61
80
|
* ```
|
|
62
81
|
*/
|
|
63
82
|
get tables(): Array<SdkModeT['TableT']>;
|
|
@@ -66,8 +85,12 @@ export declare abstract class BaseCore<SdkModeT extends SdkMode> extends Abstrac
|
|
|
66
85
|
*
|
|
67
86
|
* @example
|
|
68
87
|
* ```js
|
|
69
|
-
* import {
|
|
70
|
-
*
|
|
88
|
+
* import {useBase} from '@airtable/blocks/[placeholder-path]/ui';
|
|
89
|
+
*
|
|
90
|
+
* function MyApp() {
|
|
91
|
+
* const base = useBase();
|
|
92
|
+
* console.log(base.activeCollaborators[0].email);
|
|
93
|
+
* }
|
|
71
94
|
* ```
|
|
72
95
|
*/
|
|
73
96
|
get activeCollaborators(): Array<CollaboratorData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_core.d.ts","sourceRoot":"","sources":["../../../../../src/shared/models/base_core.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAoC,YAAY,EAAiB,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAgB7C,eAA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gBAAgB,CAAC,CAIjD;IACD;;;;;OAKG;IACH,2BAA2B,CAAC,cAAc,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAI5E;;;;;;;OAOG;IACH,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,gBAAgB;IAW7D;;;;;;;;OAQG;IACH,uBAAuB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,GAAG,IAAI;IA2BlF;;;;;;;;;OASG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAiB1E;;;;OAIG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI;IAUhE;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAOjD;;;;OAIG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI;IAQpE;;;;;;OAMG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAOrD;;;;;;;;;OASG;IACH,gBAAgB,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI;IAK5E;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAY7D;;OAEG;IACH,qBAAqB,IAAI,MAAM;CA4HlC"}
|
|
@@ -50,7 +50,7 @@ export declare abstract class FieldCore<SdkModeT extends SdkMode> extends Abstra
|
|
|
50
50
|
* @see {@link FieldType}
|
|
51
51
|
* @example
|
|
52
52
|
* ```js
|
|
53
|
-
* import {FieldType} from '@airtable/blocks/models';
|
|
53
|
+
* import {FieldType} from '@airtable/blocks/[placeholder-path]/models';
|
|
54
54
|
*
|
|
55
55
|
* if (myField.type === FieldType.CURRENCY) {
|
|
56
56
|
* console.log(myField.options.symbol);
|
|
@@ -27,7 +27,7 @@ export declare abstract class SessionCore<SdkModeT extends SdkMode> extends Abst
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```js
|
|
30
|
-
* import {useSession} from '@airtable/blocks/ui';
|
|
30
|
+
* import {useSession} from '@airtable/blocks/[placeholder-path]/ui';
|
|
31
31
|
*
|
|
32
32
|
* function CurrentUser() {
|
|
33
33
|
* const session = useSession();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_utils.d.ts","sourceRoot":"","sources":["../../../../src/shared/private_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"private_utils.d.ts","sourceRoot":"","sources":["../../../../src/shared/private_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAEvD,cAAc;AACd,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAChC,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAClC,cAAc;AACd,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAExD,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,SAAS,GACjD,CAAC,GACD,CAAC,SAAS,KAAK,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,GAC7C,CAAC,GACD,CAAC,SAAS,KAAK,CAA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CAGrF;AAED,cAAc;AACd,wBAAgB,QAAQ,CAAC,IAAI,SAAS,KAAK,CAAC,GAAG,CAAC,EAC5C,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EAC3B,SAAS,EAAE,MAAM,GAClB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAYzB;AAED,cAAc;AACd,wBAAgB,oCAAoC,IAAI,OAAO,CAE9D;AAED;;;;KAIK;AACL,wBAAgB,yBAAyB,IAAI;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAC,CAMrF"}
|
|
@@ -5,7 +5,7 @@ import { BlockInstallationId } from './types/hyper_ids';
|
|
|
5
5
|
* @hidden
|
|
6
6
|
* @example
|
|
7
7
|
* ```js
|
|
8
|
-
* import {runInfo} from '@airtable/blocks';
|
|
8
|
+
* import {runInfo} from '@airtable/blocks/base';
|
|
9
9
|
* if (runInfo.isFirstRun) {
|
|
10
10
|
* // The current user just installed this block.
|
|
11
11
|
* // Take the opportunity to show any onboarding and set
|
|
@@ -40,7 +40,7 @@ export declare abstract class BlockSdkCore<SdkModeT extends SdkMode> {
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```js
|
|
43
|
-
* import {installationId} from '@airtable/blocks';
|
|
43
|
+
* import {installationId} from '@airtable/blocks/base';
|
|
44
44
|
* console.log(installationId);
|
|
45
45
|
* // => 'blifDutUr92OKwnUn'
|
|
46
46
|
* ```
|
|
@@ -56,8 +56,8 @@ export declare abstract class BlockSdkCore<SdkModeT extends SdkMode> {
|
|
|
56
56
|
* @example
|
|
57
57
|
* ```js
|
|
58
58
|
* import React from 'react';
|
|
59
|
-
* import {reload} from '@airtable/blocks';
|
|
60
|
-
* import {Button, initializeBlock} from '@airtable/blocks/ui';
|
|
59
|
+
* import {reload} from '@airtable/blocks/base';
|
|
60
|
+
* import {Button, initializeBlock} from '@airtable/blocks/base/ui';
|
|
61
61
|
* function MyBlock() {
|
|
62
62
|
* return <Button onClick={() => reload()}>Reload</Button>;
|
|
63
63
|
* }
|
|
@@ -8,7 +8,7 @@ export type PrivateColumnType = string;
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```js
|
|
11
|
-
* import {FieldType} from '@airtable/blocks/models';
|
|
11
|
+
* import {FieldType} from '@airtable/blocks/[placeholder-path]/models';
|
|
12
12
|
* const numberFields = myTable.fields.filter(field => (
|
|
13
13
|
* field.type === FieldType.NUMBER
|
|
14
14
|
* ));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param css The CSS string.
|
|
5
5
|
* @example
|
|
6
6
|
* ```js
|
|
7
|
-
* import {loadCSSFromString} from '@airtable/blocks/ui';
|
|
7
|
+
* import {loadCSSFromString} from '@airtable/blocks/[placeholder-path]/ui';
|
|
8
8
|
* loadCSSFromString('body { background: red; }');
|
|
9
9
|
* ```
|
|
10
10
|
* @docsPath UI/utils/loadCSSFromString
|
|
@@ -18,7 +18,7 @@ export declare function loadCSSFromString(css: string): HTMLStyleElement;
|
|
|
18
18
|
* @param url The URL of the stylesheet.
|
|
19
19
|
* @example
|
|
20
20
|
* ```js
|
|
21
|
-
* import {loadCSSFromURLAsync} from '@airtable/blocks/ui';
|
|
21
|
+
* import {loadCSSFromURLAsync} from '@airtable/blocks/[placeholder-path]/ui';
|
|
22
22
|
* loadCSSFromURLAsync('https://example.com/style.css');
|
|
23
23
|
* ```
|
|
24
24
|
* @docsPath UI/utils/loadCSSFromURLAsync
|
|
@@ -32,7 +32,7 @@ export declare function loadCSSFromURLAsync(url: string): Promise<HTMLLinkElemen
|
|
|
32
32
|
* @param url The URL of the script.
|
|
33
33
|
* @example
|
|
34
34
|
* ```js
|
|
35
|
-
* import {loadScriptFromURLAsync} from '@airtable/blocks/ui';
|
|
35
|
+
* import {loadScriptFromURLAsync} from '@airtable/blocks/[placeholder-path]/ui';
|
|
36
36
|
* loadScriptFromURLAsync('https://example.com/script.js');
|
|
37
37
|
* ```
|
|
38
38
|
* @docsPath UI/utils/loadScriptFromURLAsync
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook for checking whether Airtable is in light mode or dark mode.
|
|
3
|
+
*
|
|
4
|
+
* @returns An object with a `colorScheme` property, which can be `'light'` or `'dark'`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* import {useColorScheme} from '@airtable/blocks/[placeholder-path]/ui';
|
|
9
|
+
*
|
|
10
|
+
* function MyApp() {
|
|
11
|
+
* const {colorScheme} = useColorScheme();
|
|
12
|
+
* return (
|
|
13
|
+
* <div style={colorScheme === 'dark' ?
|
|
14
|
+
* {color: 'white', backgroundColor: 'black'} :
|
|
15
|
+
* {color: 'black', backgroundColor: 'white'}
|
|
16
|
+
* }>
|
|
17
|
+
* Tada!
|
|
18
|
+
* </div>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
* @docsPath UI/hooks/useColorScheme
|
|
23
|
+
* @hook
|
|
24
|
+
*/
|
|
25
|
+
export declare function useColorScheme(): {
|
|
26
|
+
colorScheme: 'light' | 'dark';
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=use_color_scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_color_scheme.d.ts","sourceRoot":"","sources":["../../../../../src/shared/ui/use_color_scheme.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,wBAAgB,cAAc,IAAI;IAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAAA;CAAC,CAqBhE"}
|
|
@@ -6,9 +6,10 @@ import GlobalConfig from '../global_config';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```js
|
|
9
|
-
* import {
|
|
9
|
+
* import {useGlobalConfig, useRunInfo} from '@airtable/blocks/[placeholder-path]/ui';
|
|
10
10
|
*
|
|
11
11
|
* function SyncedCounter() {
|
|
12
|
+
* const runInfo = useRunInfo();
|
|
12
13
|
* const globalConfig = useGlobalConfig();
|
|
13
14
|
* const count = globalConfig.get('count');
|
|
14
15
|
*
|
|
@@ -16,13 +17,17 @@ import GlobalConfig from '../global_config';
|
|
|
16
17
|
* const decrement = () => globalConfig.setAsync('count', count - 1);
|
|
17
18
|
* const isEnabled = globalConfig.hasPermissionToSet('count');
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* <
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* if (runInfo.isPageElementInEditMode) {
|
|
21
|
+
* return (
|
|
22
|
+
* <div>
|
|
23
|
+
* <button onClick={decrement} disabled={!isEnabled} ariaLabel="decrease">-</button>
|
|
24
|
+
* {count}
|
|
25
|
+
* <button onClick={increment} disabled={!isEnabled} ariaLabel="increase">+</button>
|
|
26
|
+
* </div>
|
|
27
|
+
* );
|
|
28
|
+
* } else {
|
|
29
|
+
* return <div>{count}</div>;
|
|
30
|
+
* }
|
|
26
31
|
* }
|
|
27
32
|
* ```
|
|
28
33
|
* @docsPath UI/hooks/useGlobalConfig
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_global_config.d.ts","sourceRoot":"","sources":["../../../../../src/shared/ui/use_global_config.ts"],"names":[],"mappings":"AAAA,mDAAmD,CAAC,MAAM;AAC1D,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"use_global_config.d.ts","sourceRoot":"","sources":["../../../../../src/shared/ui/use_global_config.ts"],"names":[],"mappings":"AAAA,mDAAmD,CAAC,MAAM;AAC1D,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,IAAI,YAAY,CAKtD"}
|
|
@@ -6,7 +6,7 @@ import { GlobalConfigKey, GlobalConfigValue } from '../types/global_config';
|
|
|
6
6
|
* @param globalConfigKey
|
|
7
7
|
* @example
|
|
8
8
|
* ```js
|
|
9
|
-
* import {useBase, useSynced} from '@airtable/blocks/ui';
|
|
9
|
+
* import {useBase, useSynced} from '@airtable/blocks/[placeholder-path]/ui';
|
|
10
10
|
*
|
|
11
11
|
* function CustomInputSynced() {
|
|
12
12
|
* const [value, setValue, canSetValue] = useSynced('myGlobalConfigKey');
|
|
@@ -21,39 +21,20 @@ import Watchable from '../watchable';
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```js
|
|
24
|
-
* import {useWatchable} from '@airtable/blocks/ui';
|
|
24
|
+
* import {useWatchable} from '@airtable/blocks/[placeholder-path]/ui';
|
|
25
25
|
*
|
|
26
26
|
* function TableName({table}) {
|
|
27
27
|
* useWatchable(table, 'name');
|
|
28
28
|
* return <span>The table name is {table.name}</span>;
|
|
29
29
|
* }
|
|
30
30
|
*
|
|
31
|
-
* function
|
|
32
|
-
* useWatchable(
|
|
33
|
-
* return <span>The view name is {view.name} and the type is {view.type}</span>;
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* function RecordValuesAndColorInViewIfExists({record, field, view}) {
|
|
37
|
-
* useWatchable(record, ['cellValues', view ? `colorInView:${view.id}` : null]);
|
|
31
|
+
* function RecordValues({record, field}) {
|
|
32
|
+
* useWatchable(record, ['cellValues']);
|
|
38
33
|
* return <span>
|
|
39
34
|
* The record has cell value {record.getCellValue(field)} in {field.name}.
|
|
40
|
-
* {view ? `The record has color ${record.getColorInView(view)} in ${view.name}.` : null}
|
|
41
35
|
* </span>
|
|
42
36
|
* }
|
|
43
37
|
* ```
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```js
|
|
47
|
-
* import {useWatchable} from '@airtable/blocks/ui';
|
|
48
|
-
*
|
|
49
|
-
* function ActiveView({cursor}) {
|
|
50
|
-
* useWatchable(cursor, 'activeViewId', () => {
|
|
51
|
-
* alert('active view changed!!!')
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* return <span>Active view id: {cursor.activeViewId}</span>;
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
38
|
* @docsPath UI/hooks/useWatchable
|
|
58
39
|
* @hook
|
|
59
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_watchable.d.ts","sourceRoot":"","sources":["../../../../../src/shared/ui/use_watchable.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC
|
|
1
|
+
{"version":3,"file":"use_watchable.d.ts","sourceRoot":"","sources":["../../../../../src/shared/ui/use_watchable.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,IAAI,SAAS,MAAM,EACpD,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9F,IAAI,EAAE,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,EAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,QA8EpF"}
|
|
@@ -15,7 +15,7 @@ import * as React from 'react';
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```js
|
|
17
17
|
* import React from 'react';
|
|
18
|
-
* import {useRecords, withHooks} from '@airtable/blocks/ui';
|
|
18
|
+
* import {useRecords, withHooks} from '@airtable/blocks/base/ui';
|
|
19
19
|
*
|
|
20
20
|
* // RecordList takes a list of records and renders it
|
|
21
21
|
* class RecordList extends React.Component {
|
|
@@ -51,8 +51,8 @@ import * as React from 'react';
|
|
|
51
51
|
* @example
|
|
52
52
|
* ```js
|
|
53
53
|
* import React from 'react';
|
|
54
|
-
* import {Record, Table} from '@airtable/blocks/models';
|
|
55
|
-
* import {withHooks, useRecords} from '@airtable/blocks/ui';
|
|
54
|
+
* import {Record, Table} from '@airtable/blocks/[placeholder-path]/models';
|
|
55
|
+
* import {withHooks, useRecords} from '@airtable/blocks/[placeholder-path]/ui';
|
|
56
56
|
* // with typescript, things are a little more complex: we need to provide some type annotations to
|
|
57
57
|
* // indicate which props are injected:
|
|
58
58
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaborator_token.stories.d.ts","sourceRoot":"","sources":["../../../stories/collaborator_token.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"collaborator_token.stories.d.ts","sourceRoot":"","sources":["../../../stories/collaborator_token.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;oBAqD0X,CAAC;;;;AA9CrZ,wBAEE;AAyCF,eAAO,MAAM,QAAQ;;CAEpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_color_scheme.test.d.ts","sourceRoot":"","sources":["../../../../test/ui/use_color_scheme.test.tsx"],"names":[],"mappings":""}
|