@atlaskit/editor-plugin-extension 0.4.2 → 0.5.1
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/.eslintrc.js +26 -0
- package/CHANGELOG.md +16 -0
- package/dist/cjs/actions.js +236 -0
- package/dist/cjs/commands.js +122 -0
- package/dist/cjs/context-panel.js +269 -0
- package/dist/cjs/extension-api.js +266 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/plugin-factory.js +32 -0
- package/dist/cjs/plugin-key.js +8 -0
- package/dist/cjs/plugin.js +147 -0
- package/dist/cjs/pm-plugins/keymap.js +21 -0
- package/dist/cjs/pm-plugins/macro/actions.js +186 -0
- package/dist/cjs/pm-plugins/macro/index.js +72 -0
- package/dist/cjs/pm-plugins/macro/plugin-key.js +8 -0
- package/dist/cjs/pm-plugins/macro/types.js +5 -0
- package/dist/cjs/pm-plugins/main.js +323 -0
- package/dist/cjs/pm-plugins/unique-id.js +80 -0
- package/dist/cjs/pm-plugins/utils.js +75 -0
- package/dist/cjs/reducer.js +18 -0
- package/dist/cjs/toolbar.js +242 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +475 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +122 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanelLoader.js +23 -0
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/ErrorImage.js +76 -0
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/index.js +33 -0
- package/dist/cjs/ui/ConfigPanel/FieldMessages.js +105 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Boolean.js +150 -0
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +101 -0
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +420 -0
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +192 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Date.js +55 -0
- package/dist/cjs/ui/ConfigPanel/Fields/DateRange.js +160 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Enum.js +41 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +88 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +270 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Number.js +64 -0
- package/dist/cjs/ui/ConfigPanel/Fields/RadioGroup.js +56 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Select.js +60 -0
- package/dist/cjs/ui/ConfigPanel/Fields/SelectItem.js +53 -0
- package/dist/cjs/ui/ConfigPanel/Fields/String.js +75 -0
- package/dist/cjs/ui/ConfigPanel/Fields/TabGroup.js +73 -0
- package/dist/cjs/ui/ConfigPanel/Fields/UnhandledType.js +19 -0
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +268 -0
- package/dist/cjs/ui/ConfigPanel/Fields/common/RequiredIndicator.js +12 -0
- package/dist/cjs/ui/ConfigPanel/FormContent.js +231 -0
- package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +140 -0
- package/dist/cjs/ui/ConfigPanel/Header.js +148 -0
- package/dist/cjs/ui/ConfigPanel/LoadingState.js +25 -0
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +61 -0
- package/dist/cjs/ui/ConfigPanel/constants.js +13 -0
- package/dist/cjs/ui/ConfigPanel/index.js +9 -0
- package/dist/cjs/ui/ConfigPanel/messages.js +99 -0
- package/dist/cjs/ui/ConfigPanel/transformers.js +631 -0
- package/dist/cjs/ui/ConfigPanel/types.js +15 -0
- package/dist/cjs/ui/ConfigPanel/use-abortable-effect/index.js +56 -0
- package/dist/cjs/ui/ConfigPanel/use-state-from-promise/index.js +41 -0
- package/dist/cjs/ui/ConfigPanel/utils.js +116 -0
- package/dist/cjs/ui/SaveIndicator/SaveIndicator.js +79 -0
- package/dist/cjs/ui/SaveIndicator/messages.js +14 -0
- package/dist/cjs/ui/SaveIndicator/types.js +5 -0
- package/dist/cjs/utils.js +73 -0
- package/dist/es2019/actions.js +203 -0
- package/dist/es2019/commands.js +99 -0
- package/dist/es2019/context-panel.js +181 -0
- package/dist/es2019/extension-api.js +284 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugin-factory.js +26 -0
- package/dist/es2019/plugin-key.js +2 -0
- package/dist/es2019/plugin.js +138 -0
- package/dist/es2019/pm-plugins/keymap.js +15 -0
- package/dist/es2019/pm-plugins/macro/actions.js +152 -0
- package/dist/es2019/pm-plugins/macro/index.js +36 -0
- package/dist/es2019/pm-plugins/macro/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/macro/types.js +1 -0
- package/dist/es2019/pm-plugins/main.js +230 -0
- package/dist/es2019/pm-plugins/unique-id.js +69 -0
- package/dist/es2019/pm-plugins/utils.js +30 -0
- package/dist/es2019/reducer.js +11 -0
- package/dist/es2019/toolbar.js +236 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +415 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +100 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanelLoader.js +7 -0
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +66 -0
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/index.js +25 -0
- package/dist/es2019/ui/ConfigPanel/FieldMessages.js +101 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Boolean.js +138 -0
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +96 -0
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +411 -0
- package/dist/es2019/ui/ConfigPanel/Fields/CustomSelect.js +132 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Date.js +50 -0
- package/dist/es2019/ui/ConfigPanel/Fields/DateRange.js +139 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Enum.js +35 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +73 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +227 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Number.js +61 -0
- package/dist/es2019/ui/ConfigPanel/Fields/RadioGroup.js +40 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Select.js +50 -0
- package/dist/es2019/ui/ConfigPanel/Fields/SelectItem.js +47 -0
- package/dist/es2019/ui/ConfigPanel/Fields/String.js +67 -0
- package/dist/es2019/ui/ConfigPanel/Fields/TabGroup.js +57 -0
- package/dist/es2019/ui/ConfigPanel/Fields/UnhandledType.js +11 -0
- package/dist/es2019/ui/ConfigPanel/Fields/UserSelect.js +194 -0
- package/dist/es2019/ui/ConfigPanel/Fields/common/RequiredIndicator.js +5 -0
- package/dist/es2019/ui/ConfigPanel/FormContent.js +225 -0
- package/dist/es2019/ui/ConfigPanel/FormErrorBoundary.js +100 -0
- package/dist/es2019/ui/ConfigPanel/Header.js +140 -0
- package/dist/es2019/ui/ConfigPanel/LoadingState.js +15 -0
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +52 -0
- package/dist/es2019/ui/ConfigPanel/constants.js +7 -0
- package/dist/es2019/ui/ConfigPanel/index.js +2 -0
- package/dist/es2019/ui/ConfigPanel/messages.js +93 -0
- package/dist/es2019/ui/ConfigPanel/transformers.js +367 -0
- package/dist/es2019/ui/ConfigPanel/types.js +9 -0
- package/dist/es2019/ui/ConfigPanel/use-abortable-effect/index.js +46 -0
- package/dist/es2019/ui/ConfigPanel/use-state-from-promise/index.js +30 -0
- package/dist/es2019/ui/ConfigPanel/utils.js +86 -0
- package/dist/es2019/ui/SaveIndicator/SaveIndicator.js +66 -0
- package/dist/es2019/ui/SaveIndicator/messages.js +8 -0
- package/dist/es2019/ui/SaveIndicator/types.js +1 -0
- package/dist/es2019/utils.js +65 -0
- package/dist/esm/actions.js +223 -0
- package/dist/esm/commands.js +113 -0
- package/dist/esm/context-panel.js +261 -0
- package/dist/esm/extension-api.js +259 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugin-factory.js +25 -0
- package/dist/esm/plugin-key.js +2 -0
- package/dist/esm/plugin.js +140 -0
- package/dist/esm/pm-plugins/keymap.js +15 -0
- package/dist/esm/pm-plugins/macro/actions.js +179 -0
- package/dist/esm/pm-plugins/macro/index.js +42 -0
- package/dist/esm/pm-plugins/macro/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/macro/types.js +1 -0
- package/dist/esm/pm-plugins/main.js +298 -0
- package/dist/esm/pm-plugins/unique-id.js +74 -0
- package/dist/esm/pm-plugins/utils.js +68 -0
- package/dist/esm/reducer.js +11 -0
- package/dist/esm/toolbar.js +235 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +465 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +112 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanelLoader.js +11 -0
- package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +68 -0
- package/dist/esm/ui/ConfigPanel/ErrorMessage/index.js +26 -0
- package/dist/esm/ui/ConfigPanel/FieldMessages.js +97 -0
- package/dist/esm/ui/ConfigPanel/Fields/Boolean.js +140 -0
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +95 -0
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +414 -0
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +182 -0
- package/dist/esm/ui/ConfigPanel/Fields/Date.js +48 -0
- package/dist/esm/ui/ConfigPanel/Fields/DateRange.js +154 -0
- package/dist/esm/ui/ConfigPanel/Fields/Enum.js +34 -0
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +77 -0
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +261 -0
- package/dist/esm/ui/ConfigPanel/Fields/Number.js +57 -0
- package/dist/esm/ui/ConfigPanel/Fields/RadioGroup.js +46 -0
- package/dist/esm/ui/ConfigPanel/Fields/Select.js +50 -0
- package/dist/esm/ui/ConfigPanel/Fields/SelectItem.js +45 -0
- package/dist/esm/ui/ConfigPanel/Fields/String.js +65 -0
- package/dist/esm/ui/ConfigPanel/Fields/TabGroup.js +62 -0
- package/dist/esm/ui/ConfigPanel/Fields/UnhandledType.js +10 -0
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +258 -0
- package/dist/esm/ui/ConfigPanel/Fields/common/RequiredIndicator.js +5 -0
- package/dist/esm/ui/ConfigPanel/FormContent.js +223 -0
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +133 -0
- package/dist/esm/ui/ConfigPanel/Header.js +140 -0
- package/dist/esm/ui/ConfigPanel/LoadingState.js +17 -0
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +53 -0
- package/dist/esm/ui/ConfigPanel/constants.js +7 -0
- package/dist/esm/ui/ConfigPanel/index.js +2 -0
- package/dist/esm/ui/ConfigPanel/messages.js +93 -0
- package/dist/esm/ui/ConfigPanel/transformers.js +624 -0
- package/dist/esm/ui/ConfigPanel/types.js +9 -0
- package/dist/esm/ui/ConfigPanel/use-abortable-effect/index.js +49 -0
- package/dist/esm/ui/ConfigPanel/use-state-from-promise/index.js +34 -0
- package/dist/esm/ui/ConfigPanel/utils.js +109 -0
- package/dist/esm/ui/SaveIndicator/SaveIndicator.js +72 -0
- package/dist/esm/ui/SaveIndicator/messages.js +8 -0
- package/dist/esm/ui/SaveIndicator/types.js +1 -0
- package/dist/esm/utils.js +67 -0
- package/dist/types/actions.d.ts +20 -0
- package/dist/types/commands.d.ts +15 -0
- package/dist/types/context-panel.d.ts +10 -0
- package/dist/types/extension-api.d.ts +12 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/plugin-factory.d.ts +4 -0
- package/dist/types/plugin-key.d.ts +3 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/pm-plugins/keymap.d.ts +3 -0
- package/dist/types/pm-plugins/macro/actions.d.ts +9 -0
- package/dist/types/pm-plugins/macro/index.d.ts +8 -0
- package/dist/types/pm-plugins/macro/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/macro/types.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +25 -0
- package/dist/types/pm-plugins/unique-id.d.ts +3 -0
- package/dist/types/pm-plugins/utils.d.ts +3 -0
- package/dist/types/reducer.d.ts +2 -0
- package/dist/types/toolbar.d.ts +44 -0
- package/dist/types/types.d.ts +27 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +22 -0
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +21 -0
- package/dist/types/ui/ConfigPanel/ConfigPanelLoader.d.ts +5 -0
- package/dist/types/ui/ConfigPanel/ErrorMessage/ErrorImage.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/ErrorMessage/index.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/FieldMessages.d.ts +12 -0
- package/dist/types/ui/ConfigPanel/Fields/Boolean.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/CheckboxGroup.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/ColorPicker.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/CustomSelect.d.ts +24 -0
- package/dist/types/ui/ConfigPanel/Fields/Date.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/DateRange.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/Enum.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/Fields/Fieldset.d.ts +19 -0
- package/dist/types/ui/ConfigPanel/Fields/Number.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/RadioGroup.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/Select.d.ts +11 -0
- package/dist/types/ui/ConfigPanel/Fields/SelectItem.d.ts +5 -0
- package/dist/types/ui/ConfigPanel/Fields/String.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/TabGroup.d.ts +14 -0
- package/dist/types/ui/ConfigPanel/Fields/UnhandledType.d.ts +6 -0
- package/dist/types/ui/ConfigPanel/Fields/UserSelect.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/common/RequiredIndicator.d.ts +1 -0
- package/dist/types/ui/ConfigPanel/FormContent.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/Header.d.ts +23 -0
- package/dist/types/ui/ConfigPanel/LoadingState.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/NestedForms/RemovableField.d.ts +19 -0
- package/dist/types/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/index.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/messages.d.ts +92 -0
- package/dist/types/ui/ConfigPanel/transformers.d.ts +9 -0
- package/dist/types/ui/ConfigPanel/types.d.ts +36 -0
- package/dist/types/ui/ConfigPanel/use-abortable-effect/index.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/use-state-from-promise/index.d.ts +15 -0
- package/dist/types/ui/ConfigPanel/utils.d.ts +16 -0
- package/dist/types/ui/SaveIndicator/SaveIndicator.d.ts +4 -0
- package/dist/types/ui/SaveIndicator/messages.d.ts +7 -0
- package/dist/types/ui/SaveIndicator/types.d.ts +11 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types-ts4.5/actions.d.ts +20 -0
- package/dist/types-ts4.5/commands.d.ts +15 -0
- package/dist/types-ts4.5/context-panel.d.ts +10 -0
- package/dist/types-ts4.5/extension-api.d.ts +12 -0
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugin.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/macro/actions.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/macro/index.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/macro/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/macro/types.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +25 -0
- package/dist/types-ts4.5/pm-plugins/unique-id.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +3 -0
- package/dist/types-ts4.5/reducer.d.ts +2 -0
- package/dist/types-ts4.5/toolbar.d.ts +44 -0
- package/dist/types-ts4.5/types.d.ts +27 -2
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +22 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +21 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelLoader.d.ts +5 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ErrorMessage/ErrorImage.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ErrorMessage/index.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FieldMessages.d.ts +12 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Boolean.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/CheckboxGroup.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/ColorPicker.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/CustomSelect.d.ts +24 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Date.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/DateRange.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Enum.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Expand.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Fieldset.d.ts +19 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Number.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/RadioGroup.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Select.d.ts +11 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/SelectItem.d.ts +5 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/String.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/TabGroup.d.ts +14 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/UnhandledType.d.ts +6 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/UserSelect.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/common/RequiredIndicator.d.ts +1 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FormContent.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Header.d.ts +23 -0
- package/dist/types-ts4.5/ui/ConfigPanel/LoadingState.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/NestedForms/RemovableField.d.ts +19 -0
- package/dist/types-ts4.5/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/messages.d.ts +92 -0
- package/dist/types-ts4.5/ui/ConfigPanel/transformers.d.ts +9 -0
- package/dist/types-ts4.5/ui/ConfigPanel/types.d.ts +39 -0
- package/dist/types-ts4.5/ui/ConfigPanel/use-abortable-effect/index.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/use-state-from-promise/index.d.ts +18 -0
- package/dist/types-ts4.5/ui/ConfigPanel/utils.d.ts +16 -0
- package/dist/types-ts4.5/ui/SaveIndicator/SaveIndicator.d.ts +4 -0
- package/dist/types-ts4.5/ui/SaveIndicator/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/SaveIndicator/types.d.ts +11 -0
- package/dist/types-ts4.5/utils.d.ts +15 -0
- package/example-utils/config-panel/ConfigPanelWithExtensionPicker.tsx +217 -0
- package/example-utils/config-panel/ConfigPanelWithProviders.tsx +51 -0
- package/example-utils/config-panel/ExtensionNodePicker.tsx +141 -0
- package/example-utils/config-panel/FieldTypePicker.tsx +63 -0
- package/example-utils/config-panel/example-manifest-all-fields.ts +86 -0
- package/example-utils/config-panel/example-manifest-individual-fields.ts +85 -0
- package/example-utils/config-panel/fields.ts +611 -0
- package/package.json +49 -7
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
|
+
import { Field } from '@atlaskit/form';
|
|
4
|
+
import TextArea from '@atlaskit/textarea';
|
|
5
|
+
import TextField from '@atlaskit/textfield';
|
|
6
|
+
import FieldMessages from '../FieldMessages';
|
|
7
|
+
import { validate } from '../utils';
|
|
8
|
+
export default function String({
|
|
9
|
+
name,
|
|
10
|
+
field,
|
|
11
|
+
autoFocus,
|
|
12
|
+
onFieldChange,
|
|
13
|
+
placeholder
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
label,
|
|
17
|
+
description,
|
|
18
|
+
defaultValue,
|
|
19
|
+
isRequired
|
|
20
|
+
} = field;
|
|
21
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
22
|
+
name: name,
|
|
23
|
+
label: label,
|
|
24
|
+
defaultValue: defaultValue || '',
|
|
25
|
+
isRequired: isRequired,
|
|
26
|
+
validate: value => validate(field, value || ''),
|
|
27
|
+
testId: `config-panel-string-${name}`
|
|
28
|
+
}, ({
|
|
29
|
+
fieldProps,
|
|
30
|
+
error,
|
|
31
|
+
meta
|
|
32
|
+
}) => {
|
|
33
|
+
if (field.style === 'multiline') {
|
|
34
|
+
const {
|
|
35
|
+
onChange,
|
|
36
|
+
...restFieldProps
|
|
37
|
+
} = fieldProps;
|
|
38
|
+
const {
|
|
39
|
+
options
|
|
40
|
+
} = field;
|
|
41
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextArea, _extends({}, restFieldProps, options, {
|
|
42
|
+
onChange: e => onChange(e.currentTarget.value),
|
|
43
|
+
onBlur: () => {
|
|
44
|
+
fieldProps.onBlur();
|
|
45
|
+
onFieldChange(name, meta.dirty);
|
|
46
|
+
},
|
|
47
|
+
placeholder: placeholder,
|
|
48
|
+
"data-testid": `config-panel-textarea-${name}`
|
|
49
|
+
})), /*#__PURE__*/React.createElement(FieldMessages, {
|
|
50
|
+
error: error,
|
|
51
|
+
description: description
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextField, _extends({}, fieldProps, {
|
|
55
|
+
type: "text",
|
|
56
|
+
autoFocus: autoFocus,
|
|
57
|
+
onBlur: () => {
|
|
58
|
+
fieldProps.onBlur();
|
|
59
|
+
onFieldChange(name, meta.dirty);
|
|
60
|
+
},
|
|
61
|
+
placeholder: placeholder
|
|
62
|
+
})), /*#__PURE__*/React.createElement(FieldMessages, {
|
|
63
|
+
error: error,
|
|
64
|
+
description: description
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { injectIntl } from 'react-intl-next';
|
|
5
|
+
import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
|
|
6
|
+
const tabWrapperStyles = css({
|
|
7
|
+
// increase specificity to make sure the tab style is overridden
|
|
8
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
9
|
+
"&&& [role='tabpanel'][tabindex]": {
|
|
10
|
+
padding: 0
|
|
11
|
+
},
|
|
12
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
13
|
+
"&&& [role='tablist']::before": {
|
|
14
|
+
left: 0,
|
|
15
|
+
right: 0
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const panelWrapperStyles = css({
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
maxWidth: '100%'
|
|
21
|
+
});
|
|
22
|
+
const TabGroupImpl = props => {
|
|
23
|
+
const {
|
|
24
|
+
field,
|
|
25
|
+
renderPanel
|
|
26
|
+
} = props;
|
|
27
|
+
const {
|
|
28
|
+
fields
|
|
29
|
+
} = field;
|
|
30
|
+
const [activeTab, setActiveTab] = useState(() => {
|
|
31
|
+
const activeTabName = field.defaultTab || fields[0].name;
|
|
32
|
+
const index = fields.findIndex(f => f.name === activeTabName);
|
|
33
|
+
return Math.max(index, 0);
|
|
34
|
+
});
|
|
35
|
+
const onChange = React.useCallback(index => {
|
|
36
|
+
setActiveTab(index);
|
|
37
|
+
}, [setActiveTab]);
|
|
38
|
+
return jsx("div", {
|
|
39
|
+
css: tabWrapperStyles
|
|
40
|
+
}, jsx(Tabs, {
|
|
41
|
+
id: `configPanelTabs-${field.name}`,
|
|
42
|
+
onChange: onChange,
|
|
43
|
+
selected: activeTab
|
|
44
|
+
}, jsx(TabList, null, fields.map(({
|
|
45
|
+
name,
|
|
46
|
+
label
|
|
47
|
+
}) => jsx(Tab, {
|
|
48
|
+
key: `tab-${name}`
|
|
49
|
+
}, label))), fields.map(field => jsx(TabPanel, {
|
|
50
|
+
key: `panel-${field.name}`
|
|
51
|
+
}, jsx("div", {
|
|
52
|
+
css: panelWrapperStyles
|
|
53
|
+
}, renderPanel(field))))));
|
|
54
|
+
};
|
|
55
|
+
TabGroupImpl.displayName = 'TabGroup';
|
|
56
|
+
const TabGroup = injectIntl(TabGroupImpl);
|
|
57
|
+
export default TabGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { HelperMessage } from '@atlaskit/form';
|
|
3
|
+
export default function ({
|
|
4
|
+
errorMessage
|
|
5
|
+
}) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
// eslint-disable-next-line no-console
|
|
8
|
+
console.error(errorMessage);
|
|
9
|
+
}, [errorMessage]);
|
|
10
|
+
return /*#__PURE__*/React.createElement(HelperMessage, null, errorMessage);
|
|
11
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { getUserFieldContextProvider } from '@atlaskit/editor-common/extensions';
|
|
4
|
+
import { Field } from '@atlaskit/form';
|
|
5
|
+
import SmartUserPicker, { hydrateDefaultValues } from '@atlaskit/smart-user-picker';
|
|
6
|
+
import FieldMessages from '../FieldMessages';
|
|
7
|
+
import { validate } from '../utils';
|
|
8
|
+
import UnhandledType from './UnhandledType';
|
|
9
|
+
function makeCompat(defaultValue) {
|
|
10
|
+
if (!defaultValue) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (Array.isArray(defaultValue)) {
|
|
14
|
+
return defaultValue.map(id => ({
|
|
15
|
+
type: 'user',
|
|
16
|
+
id
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
type: 'user',
|
|
21
|
+
id: defaultValue
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function makeSafe(value) {
|
|
25
|
+
if (!value) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
const ids = [];
|
|
30
|
+
for (const {
|
|
31
|
+
id
|
|
32
|
+
} of value) {
|
|
33
|
+
ids.push(id);
|
|
34
|
+
}
|
|
35
|
+
return ids;
|
|
36
|
+
}
|
|
37
|
+
return value.id;
|
|
38
|
+
}
|
|
39
|
+
const isOptionData = value => {
|
|
40
|
+
if (!value) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return (Array.isArray(value) ? value : [value]).every(item => 'name' in item);
|
|
44
|
+
};
|
|
45
|
+
function SafeSmartUserPicker({
|
|
46
|
+
context,
|
|
47
|
+
field,
|
|
48
|
+
formFieldProps,
|
|
49
|
+
autoFocus,
|
|
50
|
+
onBlur,
|
|
51
|
+
onChange
|
|
52
|
+
}) {
|
|
53
|
+
const [unsafeValue, setUnsafeValue] = useState(null);
|
|
54
|
+
const {
|
|
55
|
+
siteId,
|
|
56
|
+
principalId,
|
|
57
|
+
fieldId,
|
|
58
|
+
productKey,
|
|
59
|
+
containerId,
|
|
60
|
+
objectId,
|
|
61
|
+
childObjectId,
|
|
62
|
+
productAttributes,
|
|
63
|
+
includeUsers = true
|
|
64
|
+
} = context;
|
|
65
|
+
const {
|
|
66
|
+
value: safeValue,
|
|
67
|
+
...formFieldPropsRest
|
|
68
|
+
} = formFieldProps;
|
|
69
|
+
const {
|
|
70
|
+
isMultiple,
|
|
71
|
+
placeholder
|
|
72
|
+
} = field;
|
|
73
|
+
function onChangeUnsafe(newValue) {
|
|
74
|
+
setUnsafeValue(newValue);
|
|
75
|
+
onChange(makeSafe(newValue));
|
|
76
|
+
}
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
let cancel = false;
|
|
79
|
+
async function hydrate() {
|
|
80
|
+
const hydrated = await hydrateDefaultValues(undefined,
|
|
81
|
+
// no need to override baseUrl
|
|
82
|
+
makeCompat(safeValue), productKey);
|
|
83
|
+
if (cancel || !isOptionData(hydrated)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setUnsafeValue(hydrated);
|
|
87
|
+
}
|
|
88
|
+
hydrate();
|
|
89
|
+
return () => {
|
|
90
|
+
cancel = true;
|
|
91
|
+
};
|
|
92
|
+
}, [safeValue, productKey]);
|
|
93
|
+
return /*#__PURE__*/React.createElement(SmartUserPicker, _extends({}, formFieldPropsRest, {
|
|
94
|
+
onChange: onChangeUnsafe,
|
|
95
|
+
autoFocus: autoFocus,
|
|
96
|
+
onBlur: onBlur,
|
|
97
|
+
maxOptions: 10,
|
|
98
|
+
isClearable: true,
|
|
99
|
+
isMulti: isMultiple,
|
|
100
|
+
includeUsers: includeUsers,
|
|
101
|
+
includeGroups: false,
|
|
102
|
+
includeTeams: false,
|
|
103
|
+
fieldId: fieldId,
|
|
104
|
+
principalId: principalId,
|
|
105
|
+
siteId: siteId,
|
|
106
|
+
productKey: productKey,
|
|
107
|
+
objectId: objectId,
|
|
108
|
+
containerId: containerId,
|
|
109
|
+
childObjectId: childObjectId,
|
|
110
|
+
placeholder: placeholder,
|
|
111
|
+
productAttributes: productAttributes,
|
|
112
|
+
value: unsafeValue,
|
|
113
|
+
width: "100%"
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
export default function UserSelect({
|
|
117
|
+
name,
|
|
118
|
+
autoFocus,
|
|
119
|
+
extensionManifest,
|
|
120
|
+
field,
|
|
121
|
+
onFieldChange
|
|
122
|
+
}) {
|
|
123
|
+
const [context, setContext] = useState({});
|
|
124
|
+
const {
|
|
125
|
+
siteId,
|
|
126
|
+
principalId,
|
|
127
|
+
fieldId,
|
|
128
|
+
productKey
|
|
129
|
+
} = context;
|
|
130
|
+
const {
|
|
131
|
+
label,
|
|
132
|
+
defaultValue,
|
|
133
|
+
description,
|
|
134
|
+
isRequired,
|
|
135
|
+
options
|
|
136
|
+
} = field;
|
|
137
|
+
const {
|
|
138
|
+
type
|
|
139
|
+
} = options.provider;
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
let cancel = false;
|
|
142
|
+
async function fetchContext() {
|
|
143
|
+
try {
|
|
144
|
+
const context = await (await getUserFieldContextProvider(extensionManifest, field.options.provider))();
|
|
145
|
+
if (cancel) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
setContext(context);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
// eslint-disable-next-line no-console
|
|
151
|
+
console.error(e);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
fetchContext();
|
|
155
|
+
return () => {
|
|
156
|
+
cancel = true;
|
|
157
|
+
};
|
|
158
|
+
}, [extensionManifest, field.options.provider]);
|
|
159
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
160
|
+
name: name,
|
|
161
|
+
label: label,
|
|
162
|
+
isRequired: isRequired,
|
|
163
|
+
defaultValue: defaultValue,
|
|
164
|
+
validate: value => validate(field, value),
|
|
165
|
+
testId: `config-panel-user-select-${name}`
|
|
166
|
+
}, ({
|
|
167
|
+
fieldProps,
|
|
168
|
+
error
|
|
169
|
+
}) => {
|
|
170
|
+
// if any of these don't exists, the provider is missing
|
|
171
|
+
if (!siteId || !principalId || !fieldId || !productKey) {
|
|
172
|
+
return /*#__PURE__*/React.createElement(UnhandledType, {
|
|
173
|
+
key: name,
|
|
174
|
+
field: field,
|
|
175
|
+
errorMessage: `Field "${name}" can't be renderered. Missing provider for "${type}".`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function onChange(newValue) {
|
|
179
|
+
fieldProps.onChange(newValue);
|
|
180
|
+
onFieldChange(name, true);
|
|
181
|
+
}
|
|
182
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SafeSmartUserPicker, {
|
|
183
|
+
context: context,
|
|
184
|
+
field: field,
|
|
185
|
+
formFieldProps: fieldProps,
|
|
186
|
+
autoFocus: autoFocus || false,
|
|
187
|
+
onBlur: () => onFieldChange(name, true),
|
|
188
|
+
onChange: onChange
|
|
189
|
+
}), /*#__PURE__*/React.createElement(FieldMessages, {
|
|
190
|
+
error: error,
|
|
191
|
+
description: description
|
|
192
|
+
}));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isFieldset } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import Boolean from './Fields/Boolean';
|
|
4
|
+
import ColorPicker from './Fields/ColorPicker';
|
|
5
|
+
import CustomSelect from './Fields/CustomSelect';
|
|
6
|
+
import Date from './Fields/Date';
|
|
7
|
+
import DateRange from './Fields/DateRange';
|
|
8
|
+
import Enum from './Fields/Enum';
|
|
9
|
+
import Expand from './Fields/Expand';
|
|
10
|
+
import Fieldset from './Fields/Fieldset';
|
|
11
|
+
import Number from './Fields/Number';
|
|
12
|
+
import String from './Fields/String';
|
|
13
|
+
import TabGroup from './Fields/TabGroup';
|
|
14
|
+
import UnhandledType from './Fields/UnhandledType';
|
|
15
|
+
import UserSelect from './Fields/UserSelect';
|
|
16
|
+
import { FormErrorBoundary } from './FormErrorBoundary';
|
|
17
|
+
import RemovableField from './NestedForms/RemovableField';
|
|
18
|
+
import { getSafeParentedName } from './utils';
|
|
19
|
+
export function FieldComponent({
|
|
20
|
+
field,
|
|
21
|
+
parameters,
|
|
22
|
+
parentName,
|
|
23
|
+
extensionManifest,
|
|
24
|
+
firstVisibleFieldName,
|
|
25
|
+
onFieldChange,
|
|
26
|
+
featureFlags
|
|
27
|
+
}) {
|
|
28
|
+
var _parameters$errors;
|
|
29
|
+
const {
|
|
30
|
+
name,
|
|
31
|
+
type
|
|
32
|
+
} = field;
|
|
33
|
+
const autoFocus = name === firstVisibleFieldName;
|
|
34
|
+
const defaultValue = parameters[name];
|
|
35
|
+
const error = (_parameters$errors = parameters.errors) === null || _parameters$errors === void 0 ? void 0 : _parameters$errors[name];
|
|
36
|
+
const parentedName = getSafeParentedName(name, parentName);
|
|
37
|
+
const fieldDefaultValue = field.type === 'enum' ? field.defaultValue : undefined;
|
|
38
|
+
if (name in parameters && !isFieldset(field)) {
|
|
39
|
+
field = {
|
|
40
|
+
...field,
|
|
41
|
+
...(defaultValue != null ? {
|
|
42
|
+
defaultValue
|
|
43
|
+
} : {})
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
switch (field.type) {
|
|
47
|
+
case 'string':
|
|
48
|
+
return /*#__PURE__*/React.createElement(String, {
|
|
49
|
+
name: parentedName,
|
|
50
|
+
field: field,
|
|
51
|
+
autoFocus: autoFocus,
|
|
52
|
+
onFieldChange: onFieldChange,
|
|
53
|
+
placeholder: field.placeholder
|
|
54
|
+
});
|
|
55
|
+
case 'number':
|
|
56
|
+
return /*#__PURE__*/React.createElement(Number, {
|
|
57
|
+
name: parentedName,
|
|
58
|
+
field: field,
|
|
59
|
+
autoFocus: autoFocus,
|
|
60
|
+
onFieldChange: onFieldChange,
|
|
61
|
+
placeholder: field.placeholder
|
|
62
|
+
});
|
|
63
|
+
case 'boolean':
|
|
64
|
+
return /*#__PURE__*/React.createElement(Boolean, {
|
|
65
|
+
name: parentedName,
|
|
66
|
+
field: field,
|
|
67
|
+
onFieldChange: onFieldChange
|
|
68
|
+
});
|
|
69
|
+
case 'color':
|
|
70
|
+
return /*#__PURE__*/React.createElement(ColorPicker, {
|
|
71
|
+
name: parentedName,
|
|
72
|
+
field: field,
|
|
73
|
+
onFieldChange: onFieldChange,
|
|
74
|
+
featureFlags: featureFlags
|
|
75
|
+
});
|
|
76
|
+
case 'date':
|
|
77
|
+
return /*#__PURE__*/React.createElement(Date, {
|
|
78
|
+
name: parentedName,
|
|
79
|
+
field: field,
|
|
80
|
+
autoFocus: autoFocus,
|
|
81
|
+
onFieldChange: onFieldChange,
|
|
82
|
+
placeholder: field.placeholder
|
|
83
|
+
});
|
|
84
|
+
case 'date-range':
|
|
85
|
+
return /*#__PURE__*/React.createElement(DateRange, {
|
|
86
|
+
name: parentedName,
|
|
87
|
+
field: field,
|
|
88
|
+
autoFocus: autoFocus,
|
|
89
|
+
onFieldChange: onFieldChange
|
|
90
|
+
});
|
|
91
|
+
case 'enum':
|
|
92
|
+
return /*#__PURE__*/React.createElement(Enum, {
|
|
93
|
+
name: parentedName,
|
|
94
|
+
field: field,
|
|
95
|
+
autoFocus: autoFocus,
|
|
96
|
+
onFieldChange: onFieldChange,
|
|
97
|
+
fieldDefaultValue: fieldDefaultValue
|
|
98
|
+
});
|
|
99
|
+
case 'custom':
|
|
100
|
+
return /*#__PURE__*/React.createElement(CustomSelect, {
|
|
101
|
+
name: parentedName,
|
|
102
|
+
field: field,
|
|
103
|
+
extensionManifest: extensionManifest,
|
|
104
|
+
placeholder: field.placeholder,
|
|
105
|
+
autoFocus: autoFocus,
|
|
106
|
+
onFieldChange: onFieldChange,
|
|
107
|
+
parameters: parameters
|
|
108
|
+
});
|
|
109
|
+
case 'fieldset':
|
|
110
|
+
return /*#__PURE__*/React.createElement(Fieldset, {
|
|
111
|
+
name: parentedName,
|
|
112
|
+
field: field,
|
|
113
|
+
firstVisibleFieldName: firstVisibleFieldName,
|
|
114
|
+
onFieldChange: onFieldChange,
|
|
115
|
+
extensionManifest: extensionManifest,
|
|
116
|
+
parameters: defaultValue || {},
|
|
117
|
+
error: error,
|
|
118
|
+
formComponent: FormContent
|
|
119
|
+
});
|
|
120
|
+
case 'user':
|
|
121
|
+
return /*#__PURE__*/React.createElement(UserSelect, {
|
|
122
|
+
name: parentedName,
|
|
123
|
+
field: field,
|
|
124
|
+
autoFocus: name === firstVisibleFieldName,
|
|
125
|
+
extensionManifest: extensionManifest,
|
|
126
|
+
onFieldChange: onFieldChange
|
|
127
|
+
});
|
|
128
|
+
case 'expand':
|
|
129
|
+
{
|
|
130
|
+
// if expand is under a tab with hasGroupedValues=true
|
|
131
|
+
const resolvedParentName = [parentName, field.hasGroupedValues ? field.name : undefined].filter(val => !!val).join('.') || undefined;
|
|
132
|
+
const resolvedParameters = !field.hasGroupedValues ? parameters : parameters[field.name] || {};
|
|
133
|
+
return /*#__PURE__*/React.createElement(Expand, {
|
|
134
|
+
field: field,
|
|
135
|
+
isExpanded: field.isExpanded
|
|
136
|
+
}, /*#__PURE__*/React.createElement(FormContent, {
|
|
137
|
+
parentName: resolvedParentName,
|
|
138
|
+
fields: field.fields,
|
|
139
|
+
parameters: resolvedParameters,
|
|
140
|
+
onFieldChange: onFieldChange,
|
|
141
|
+
extensionManifest: extensionManifest,
|
|
142
|
+
featureFlags: featureFlags
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
case 'tab-group':
|
|
146
|
+
{
|
|
147
|
+
const tabGroupField = field;
|
|
148
|
+
const tabGroupParams = tabGroupField.hasGroupedValues ? parameters[tabGroupField.name] || {} : parameters;
|
|
149
|
+
const renderPanel = tabField => {
|
|
150
|
+
const parentName = [tabGroupField.hasGroupedValues ? tabGroupField.name : undefined, tabField.hasGroupedValues ? tabField.name : undefined].filter(val => !!val).join('.') || undefined;
|
|
151
|
+
const tabParameters = tabField.hasGroupedValues ? tabGroupParams[tabField.name] || {} : tabGroupParams;
|
|
152
|
+
return /*#__PURE__*/React.createElement(FormContent, {
|
|
153
|
+
parentName: parentName,
|
|
154
|
+
fields: tabField.fields,
|
|
155
|
+
parameters: tabParameters,
|
|
156
|
+
onFieldChange: onFieldChange,
|
|
157
|
+
extensionManifest: extensionManifest,
|
|
158
|
+
featureFlags: featureFlags
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
return /*#__PURE__*/React.createElement(TabGroup, {
|
|
162
|
+
field: tabGroupField,
|
|
163
|
+
renderPanel: renderPanel
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
default:
|
|
167
|
+
return /*#__PURE__*/React.createElement(UnhandledType, {
|
|
168
|
+
field: field,
|
|
169
|
+
errorMessage: `Field "${name}" of type "${type}" not supported`
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function Hidden({
|
|
174
|
+
children
|
|
175
|
+
}) {
|
|
176
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
style: {
|
|
178
|
+
display: 'none'
|
|
179
|
+
}
|
|
180
|
+
}, children);
|
|
181
|
+
}
|
|
182
|
+
export default function FormContent({
|
|
183
|
+
fields,
|
|
184
|
+
parentName,
|
|
185
|
+
parameters,
|
|
186
|
+
extensionManifest,
|
|
187
|
+
canRemoveFields,
|
|
188
|
+
onClickRemove,
|
|
189
|
+
onFieldChange,
|
|
190
|
+
firstVisibleFieldName,
|
|
191
|
+
contextIdentifierProvider,
|
|
192
|
+
featureFlags
|
|
193
|
+
}) {
|
|
194
|
+
return /*#__PURE__*/React.createElement(FormErrorBoundary, {
|
|
195
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
196
|
+
extensionKey: extensionManifest.key,
|
|
197
|
+
fields: fields
|
|
198
|
+
}, fields.map(field => {
|
|
199
|
+
let fieldElement = /*#__PURE__*/React.createElement(FieldComponent, {
|
|
200
|
+
field: field,
|
|
201
|
+
parameters: parameters || {},
|
|
202
|
+
parentName: parentName,
|
|
203
|
+
extensionManifest: extensionManifest,
|
|
204
|
+
firstVisibleFieldName: firstVisibleFieldName,
|
|
205
|
+
onFieldChange: onFieldChange,
|
|
206
|
+
featureFlags: featureFlags
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// only to be supported by String fields at this time
|
|
210
|
+
if ('isHidden' in field && field.isHidden) {
|
|
211
|
+
fieldElement = /*#__PURE__*/React.createElement(Hidden, null, fieldElement);
|
|
212
|
+
}
|
|
213
|
+
const {
|
|
214
|
+
name,
|
|
215
|
+
type
|
|
216
|
+
} = field;
|
|
217
|
+
return /*#__PURE__*/React.createElement(RemovableField, {
|
|
218
|
+
key: name,
|
|
219
|
+
name: name,
|
|
220
|
+
canRemoveField: canRemoveFields && !field.isRequired,
|
|
221
|
+
onClickRemove: onClickRemove,
|
|
222
|
+
className: `field-wrapper-${type}`
|
|
223
|
+
}, fieldElement);
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, editorAnalyticsChannel, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
7
|
+
import { messages } from './messages';
|
|
8
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
9
|
+
class FormErrorBoundaryInner extends React.Component {
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
12
|
+
_defineProperty(this, "state", {
|
|
13
|
+
error: undefined
|
|
14
|
+
});
|
|
15
|
+
_defineProperty(this, "getProductName", async () => {
|
|
16
|
+
const {
|
|
17
|
+
contextIdentifierProvider
|
|
18
|
+
} = this.props;
|
|
19
|
+
if (contextIdentifierProvider) {
|
|
20
|
+
const context = await contextIdentifierProvider;
|
|
21
|
+
if (context.product) {
|
|
22
|
+
return context.product;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return 'atlaskit';
|
|
26
|
+
});
|
|
27
|
+
_defineProperty(this, "fireAnalytics", analyticsErrorPayload => {
|
|
28
|
+
const {
|
|
29
|
+
createAnalyticsEvent,
|
|
30
|
+
extensionKey,
|
|
31
|
+
fields
|
|
32
|
+
} = this.props;
|
|
33
|
+
this.getProductName().then(product => {
|
|
34
|
+
var _window, _window$navigator;
|
|
35
|
+
if (!createAnalyticsEvent) {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.error('ConfigPanel FormErrorBoundary: Missing `createAnalyticsEvent`', {
|
|
38
|
+
channel: editorAnalyticsChannel,
|
|
39
|
+
product,
|
|
40
|
+
error: analyticsErrorPayload
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
error,
|
|
46
|
+
errorInfo,
|
|
47
|
+
errorStack
|
|
48
|
+
} = analyticsErrorPayload;
|
|
49
|
+
const payload = {
|
|
50
|
+
action: ACTION.ERRORED,
|
|
51
|
+
actionSubject: ACTION_SUBJECT.CONFIG_PANEL,
|
|
52
|
+
eventType: EVENT_TYPE.UI,
|
|
53
|
+
attributes: {
|
|
54
|
+
product,
|
|
55
|
+
browserInfo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) || 'unknown',
|
|
56
|
+
extensionKey,
|
|
57
|
+
fields: JSON.stringify(fields),
|
|
58
|
+
error,
|
|
59
|
+
errorInfo,
|
|
60
|
+
errorStack
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
createAnalyticsEvent(payload).fire(editorAnalyticsChannel);
|
|
64
|
+
}).catch(e => {
|
|
65
|
+
// eslint-disable-next-line no-console
|
|
66
|
+
console.error('Failed to resolve product name from contextIdentifierProvider.', e);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
componentDidCatch(error, errorInfo) {
|
|
71
|
+
this.setState({
|
|
72
|
+
error
|
|
73
|
+
}, () => {
|
|
74
|
+
// Log the error
|
|
75
|
+
this.fireAnalytics({
|
|
76
|
+
error: error.toString(),
|
|
77
|
+
errorInfo,
|
|
78
|
+
errorStack: error.stack
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
const {
|
|
84
|
+
intl
|
|
85
|
+
} = this.props;
|
|
86
|
+
const {
|
|
87
|
+
error
|
|
88
|
+
} = this.state;
|
|
89
|
+
if (!error) {
|
|
90
|
+
return this.props.children;
|
|
91
|
+
}
|
|
92
|
+
return /*#__PURE__*/React.createElement(SectionMessage, {
|
|
93
|
+
title: intl.formatMessage(messages.errorBoundaryTitle),
|
|
94
|
+
appearance: "error"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, error.message)), /*#__PURE__*/React.createElement("p", null, intl.formatMessage(messages.errorBoundaryNote)));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export const FormErrorBoundaryImpl = injectIntl(FormErrorBoundaryInner);
|
|
99
|
+
export const FormErrorBoundary = withAnalyticsContext()(withAnalyticsEvents()(FormErrorBoundaryImpl));
|
|
100
|
+
FormErrorBoundary.displayName = 'FormErrorBoundary';
|