@backstage/plugin-scaffolder-react 1.13.2 → 1.13.3-next.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +45 -4
  2. package/alpha/package.json +1 -1
  3. package/dist/api/ref.esm.js.map +1 -1
  4. package/dist/extensions/index.esm.js.map +1 -1
  5. package/dist/extensions/keys.esm.js.map +1 -1
  6. package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
  7. package/dist/hooks/useCustomLayouts.esm.js.map +1 -1
  8. package/dist/hooks/useEventStream.esm.js.map +1 -1
  9. package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
  10. package/dist/layouts/keys.esm.js.map +1 -1
  11. package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
  12. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  13. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  14. package/dist/next/components/Form/Form.esm.js.map +1 -1
  15. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  16. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  17. package/dist/next/components/ReviewState/util.esm.js.map +1 -1
  18. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  19. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  20. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  21. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  22. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  23. package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
  24. package/dist/next/components/Stepper/utils.esm.js.map +1 -1
  25. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  26. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  27. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  28. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  29. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  30. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  31. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  32. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  33. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  34. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  35. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  36. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  37. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  38. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  39. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  40. package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
  41. package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
  42. package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
  43. package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
  44. package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
  45. package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
  46. package/dist/next/lib/schema.esm.js.map +1 -1
  47. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  48. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  49. package/dist/utils.esm.js.map +1 -1
  50. package/package.json +18 -18
package/CHANGELOG.md CHANGED
@@ -1,16 +1,57 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
- ## 1.13.2
3
+ ## 1.13.3-next.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - e2f94f7: Fix issue with `Stepper` and trying to trim additional properties. This is now all behind `liveOmit` and `omitExtraData` instead.
7
+ - Updated dependencies
8
+ - @backstage/catalog-client@1.8.0-next.1
9
+ - @backstage/plugin-catalog-react@1.14.1-next.2
10
+ - @backstage/catalog-model@1.7.0
11
+ - @backstage/core-components@0.16.0-next.1
12
+ - @backstage/core-plugin-api@1.10.0
13
+ - @backstage/frontend-plugin-api@0.9.1-next.1
14
+ - @backstage/theme@0.6.1-next.0
15
+ - @backstage/types@1.1.1
16
+ - @backstage/version-bridge@1.0.10
17
+ - @backstage/plugin-permission-react@0.4.27
18
+ - @backstage/plugin-scaffolder-common@1.5.6
19
+
20
+ ## 1.13.3-next.1
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+ - @backstage/theme@0.6.1-next.0
26
+ - @backstage/catalog-client@1.8.0-next.0
27
+ - @backstage/catalog-model@1.7.0
28
+ - @backstage/core-components@0.16.0-next.1
29
+ - @backstage/core-plugin-api@1.10.0
30
+ - @backstage/frontend-plugin-api@0.9.1-next.1
31
+ - @backstage/types@1.1.1
32
+ - @backstage/version-bridge@1.0.10
33
+ - @backstage/plugin-catalog-react@1.14.1-next.1
34
+ - @backstage/plugin-permission-react@0.4.27
35
+ - @backstage/plugin-scaffolder-common@1.5.6
8
36
 
9
- ## 1.13.1
37
+ ## 1.13.2-next.0
10
38
 
11
39
  ### Patch Changes
12
40
 
13
- - 42ef107: Fix issue with form state not refreshing when updating
41
+ - 8b5ff7e: Fix issue with form state not refreshing when updating
42
+ - ade301c: Fix issue with `Stepper` and trying to trim additional properties. This is now all behind `liveOmit` and `omitExtraData` instead.
43
+ - Updated dependencies
44
+ - @backstage/core-components@0.16.0-next.0
45
+ - @backstage/catalog-client@1.8.0-next.0
46
+ - @backstage/catalog-model@1.7.0
47
+ - @backstage/core-plugin-api@1.10.0
48
+ - @backstage/frontend-plugin-api@0.9.1-next.0
49
+ - @backstage/theme@0.6.0
50
+ - @backstage/types@1.1.1
51
+ - @backstage/version-bridge@1.0.10
52
+ - @backstage/plugin-catalog-react@1.14.1-next.0
53
+ - @backstage/plugin-permission-react@0.4.27
54
+ - @backstage/plugin-scaffolder-common@1.5.6
14
55
 
15
56
  ## 1.13.0
16
57
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react__alpha",
3
- "version": "1.13.2",
3
+ "version": "1.13.3-next.2",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -1 +1 @@
1
- {"version":3,"file":"ref.esm.js","sources":["../../src/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderApi } from './types';\n\n/** @public */\nexport const scaffolderApiRef = createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAA4B,CAAA;AAAA,EAC1D,EAAI,EAAA,2BAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"ref.esm.js","sources":["../../src/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderApi } from './types';\n\n/** @public */\nexport const scaffolderApiRef = createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAA4B,CAAA;AAAA,EAC1D,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/extensions/index.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\nexport type {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n};\n\nexport * from './rjsf';\n"],"names":[],"mappings":";;;AAgCO,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA,CAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,wBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,4BAET,MAA0B,KAAA;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/extensions/index.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\nexport type {\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n FieldExtensionUiSchema,\n CustomFieldExtensionSchema,\n};\n\nexport * from './rjsf';\n"],"names":[],"mappings":";;;AAgCO,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAO,OAAA,wBAAA;AAAA;AACT,GACF;AACF;AAOO,MAAM,4BAET,MAA0B;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.esm.js","sources":["../../src/extensions/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAA8B,GAAA,mCAAA;AAIpC,MAAM,mBAAsB,GAAA;;;;"}
1
+ {"version":3,"file":"keys.esm.js","sources":["../../src/extensions/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAA8B,GAAA;AAIpC,MAAM,mBAAsB,GAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AA0Ba,MAAA,wBAAA,GAA2B,CAGtC,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,2BAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA,mBAAA;AAAA,KACN,CAAA;AAAA,GACL,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AA0Ba,MAAA,wBAAA,GAA2B,CAGtC,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomLayouts.esm.js","sources":["../../src/hooks/useCustomLayouts.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AAuBa,MAAA,gBAAA,GAAmB,CAC9B,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,mBAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA,WAAA;AAAA,KACN,CAAA;AAAA,GACL,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useCustomLayouts.esm.js","sources":["../../src/hooks/useCustomLayouts.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n"],"names":[],"mappings":";;;AAuBa,MAAA,gBAAA,GAAmB,CAC9B,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEventStream.esm.js","sources":["../../src/hooks/useEventStream.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n LogEvent,\n scaffolderApiRef,\n ScaffolderTask,\n ScaffolderTaskOutput,\n ScaffolderTaskStatus,\n} from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n cancelled: boolean;\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n recoverStrategy?: 'none' | 'startOver';\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'CANCELLED' }\n | { type: 'RECOVERED'; data: ReducerLogEntry }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.loading = false;\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (currentStep) {\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'completed', 'failed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'CANCELLED': {\n draft.cancelled = true;\n return;\n }\n\n case 'RECOVERED': {\n draft.cancelled = false;\n draft.completed = false;\n draft.output = undefined;\n draft.error = undefined;\n\n for (const stepId in draft.steps) {\n if (draft.steps.hasOwnProperty(stepId)) {\n draft.steps[stepId].startedAt = undefined;\n draft.steps[stepId].endedAt = undefined;\n draft.steps[stepId].status = 'open';\n }\n }\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n cancelled: false,\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n let retryCount = 1;\n let isTaskRecoverable = false;\n const startStreamLogProcess = () =>\n scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel) {\n return;\n }\n isTaskRecoverable =\n task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy ===\n 'startOver';\n dispatch({ type: 'INIT', data: task });\n\n // TODO(blam): Use a normal fetch to fetch the current log for the event stream\n // and use that for an INIT_EVENTs dispatch event, and then\n // use the last event ID to subscribe using after option to\n // stream logs. Without this, if you have a lot of logs, it can look like the\n // task is being rebuilt on load as it progresses through the steps at a slower\n // rate whilst it builds the status from the event logs\n const observable = scaffolderApi.streamLogs({\n isTaskRecoverable,\n taskId,\n });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(\n 0,\n collectedLogEvents.length,\n );\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n retryCount = 1;\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'cancelled':\n dispatch({ type: 'CANCELLED' });\n return undefined;\n case 'completion':\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n return undefined;\n case 'recovered':\n dispatch({ type: 'RECOVERED', data: event });\n return undefined;\n default:\n throw new Error(\n `Unhandled event type ${event.type} in observer`,\n );\n }\n },\n error: error => {\n emitLogs();\n // in some cases the error is a refused connection from backend\n // this can happen from internet issues or proxy problems\n // so we try to reconnect again after some time\n // just to restart the fetch process\n // details here https://github.com/backstage/backstage/issues/15002\n\n const maxRetries = 3;\n\n if (!error.message) {\n error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${\n retryCount > maxRetries ? maxRetries : retryCount\n }/${maxRetries} retries)`;\n }\n\n setTimeout(() => {\n retryCount += 1;\n void startStreamLogProcess();\n }, 15000);\n\n dispatch({ type: 'ERROR', data: error });\n },\n });\n },\n error => {\n if (!didCancel) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n void startStreamLogProcess();\n return () => {\n if (!isTaskRecoverable) {\n didCancel = true;\n if (subscription) {\n subscription.unsubscribe();\n }\n if (logPusher) {\n clearInterval(logPusher);\n }\n }\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n"],"names":[],"mappings":";;;;;AA4EA,SAAS,OAAA,CAAQ,OAAmB,MAAuB,EAAA;AACzD,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,MAAQ,EAAA;AACX,MAAM,KAAA,CAAA,KAAA,GAAQ,OAAO,IAAK,CAAA,IAAA,CAAK,MAAM,MAAO,CAAA,CAAC,SAAS,IAAS,KAAA;AAC7D,QAAQ,OAAA,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAE,QAAQ,MAAQ,EAAA,EAAA,EAAI,KAAK,EAAG,EAAA,CAAA;AACjD,QAAO,OAAA,OAAA,CAAA;AAAA,OACT,EAAG,EAA4C,CAAA,CAAA;AAC/C,MAAM,KAAA,CAAA,QAAA,GAAW,OAAO,IAAK,CAAA,IAAA,CAAK,MAAM,MAAO,CAAA,CAAC,SAAS,IAAS,KAAA;AAChE,QAAQ,OAAA,CAAA,IAAA,CAAK,EAAE,CAAA,GAAI,EAAC,CAAA;AACpB,QAAO,OAAA,OAAA,CAAA;AAAA,OACT,EAAG,EAAsC,CAAA,CAAA;AACzC,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EventStream.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n LogEvent,\n scaffolderApiRef,\n ScaffolderTask,\n ScaffolderTaskOutput,\n ScaffolderTaskStatus,\n} from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n cancelled: boolean;\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n recoverStrategy?: 'none' | 'startOver';\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'CANCELLED' }\n | { type: 'RECOVERED'; data: ReducerLogEntry }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.loading = false;\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (currentStep) {\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'completed', 'failed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'CANCELLED': {\n draft.cancelled = true;\n return;\n }\n\n case 'RECOVERED': {\n draft.cancelled = false;\n draft.completed = false;\n draft.output = undefined;\n draft.error = undefined;\n\n for (const stepId in draft.steps) {\n if (draft.steps.hasOwnProperty(stepId)) {\n draft.steps[stepId].startedAt = undefined;\n draft.steps[stepId].endedAt = undefined;\n draft.steps[stepId].status = 'open';\n }\n }\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n cancelled: false,\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n let retryCount = 1;\n let isTaskRecoverable = false;\n const startStreamLogProcess = () =>\n scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel) {\n return;\n }\n isTaskRecoverable =\n task.spec.EXPERIMENTAL_recovery?.EXPERIMENTAL_strategy ===\n 'startOver';\n dispatch({ type: 'INIT', data: task });\n\n // TODO(blam): Use a normal fetch to fetch the current log for the event stream\n // and use that for an INIT_EVENTs dispatch event, and then\n // use the last event ID to subscribe using after option to\n // stream logs. Without this, if you have a lot of logs, it can look like the\n // task is being rebuilt on load as it progresses through the steps at a slower\n // rate whilst it builds the status from the event logs\n const observable = scaffolderApi.streamLogs({\n isTaskRecoverable,\n taskId,\n });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(\n 0,\n collectedLogEvents.length,\n );\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n retryCount = 1;\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'cancelled':\n dispatch({ type: 'CANCELLED' });\n return undefined;\n case 'completion':\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n return undefined;\n case 'recovered':\n dispatch({ type: 'RECOVERED', data: event });\n return undefined;\n default:\n throw new Error(\n `Unhandled event type ${event.type} in observer`,\n );\n }\n },\n error: error => {\n emitLogs();\n // in some cases the error is a refused connection from backend\n // this can happen from internet issues or proxy problems\n // so we try to reconnect again after some time\n // just to restart the fetch process\n // details here https://github.com/backstage/backstage/issues/15002\n\n const maxRetries = 3;\n\n if (!error.message) {\n error.message = `We cannot connect at the moment, trying again in some seconds... Retrying (${\n retryCount > maxRetries ? maxRetries : retryCount\n }/${maxRetries} retries)`;\n }\n\n setTimeout(() => {\n retryCount += 1;\n void startStreamLogProcess();\n }, 15000);\n\n dispatch({ type: 'ERROR', data: error });\n },\n });\n },\n error => {\n if (!didCancel) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n void startStreamLogProcess();\n return () => {\n if (!isTaskRecoverable) {\n didCancel = true;\n if (subscription) {\n subscription.unsubscribe();\n }\n if (logPusher) {\n clearInterval(logPusher);\n }\n }\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n"],"names":[],"mappings":";;;;;AA4EA,SAAS,OAAA,CAAQ,OAAmB,MAAuB,EAAA;AACzD,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,MAAQ,EAAA;AACX,MAAM,KAAA,CAAA,KAAA,GAAQ,OAAO,IAAK,CAAA,IAAA,CAAK,MAAM,MAAO,CAAA,CAAC,SAAS,IAAS,KAAA;AAC7D,QAAQ,OAAA,CAAA,IAAA,CAAK,EAAE,CAAI,GAAA,EAAE,QAAQ,MAAQ,EAAA,EAAA,EAAI,KAAK,EAAG,EAAA;AACjD,QAAO,OAAA,OAAA;AAAA,OACT,EAAG,EAA4C,CAAA;AAC/C,MAAM,KAAA,CAAA,QAAA,GAAW,OAAO,IAAK,CAAA,IAAA,CAAK,MAAM,MAAO,CAAA,CAAC,SAAS,IAAS,KAAA;AAChE,QAAQ,OAAA,CAAA,IAAA,CAAK,EAAE,CAAA,GAAI,EAAC;AACpB,QAAO,OAAA,OAAA;AAAA,OACT,EAAG,EAAsC,CAAA;AACzC,MAAA,KAAA,CAAM,OAAU,GAAA,KAAA;AAChB,MAAA,KAAA,CAAM,KAAQ,GAAA,KAAA,CAAA;AACd,MAAA,KAAA,CAAM,SAAY,GAAA,KAAA;AAClB,MAAA,KAAA,CAAM,OAAO,MAAO,CAAA,IAAA;AACpB,MAAA;AAAA;AACF,IAEA,KAAK,MAAQ,EAAA;AACX,MAAA,MAAM,UAAU,MAAO,CAAA,IAAA;AAGvB,MAAA,KAAA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GAAA,IAAA;AACZ,QAAA,IAAI,YAAc,EAAA;AAChB,UAAA,YAAA,CAAa,WAAY,EAAA;AAAA;AAE3B,QAAA,IAAI,SAAW,EAAA;AACb,UAAA,aAAA,CAAc,SAAS,CAAA;AAAA;AACzB;AACF,KACF;AAAA,GACC,EAAA,CAAC,aAAe,EAAA,QAAA,EAAU,MAAM,CAAC,CAAA;AAEpC,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport React from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OACyC,EAAA;AACzC,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA,CAAA;AAEpC,MAAoB,mBAAA,CAAA,gBAAA,EAAkB,aAAa,OAAO,CAAA,CAAA;AAE1D,MAAO,OAAA,gBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,oBAET,MAA0B,KAAA;AAE9B,mBAAoB,CAAA,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
1
+ {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport React from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OACyC,EAAA;AACzC,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA;AAEpC,MAAoB,mBAAA,CAAA,gBAAA,EAAkB,aAAa,OAAO,CAAA;AAE1D,MAAO,OAAA,gBAAA;AAAA;AACT,GACF;AACF;AAOO,MAAM,oBAET,MAA0B;AAE9B,mBAAoB,CAAA,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAc,GAAA,uBAAA;AACpB,MAAM,mBAAsB,GAAA;;;;"}
1
+ {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAc,GAAA;AACpB,MAAM,mBAAsB,GAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { z } from 'zod';\n\nimport { OpaqueFormField, FormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: { id: 'api:scaffolder/form-fields', input: 'formFields' },\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,yBAAA,GAA4B,sBAEhC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA,8BAAA;AACN,CAAC,CAAA,CAAA;AAMM,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,EACzD,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,4BAAA,EAA8B,OAAO,YAAa,EAAA;AAAA,EAClE,QAAU,EAAA;AAAA,IACR,eAAiB,EAAA,yBAAA;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAA6C,EAAA;AACpD,IAAM,MAAA,yBAAA,CAA0B,OAAO,KAAK,CAAA,CAAA;AAAA,GAC9C;AACF,CAAC,EAAA;AAMM,SAAS,gBAGd,IAAmE,EAAA;AACnE,EAAO,OAAA,eAAA,CAAgB,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA,CAAA;AAClD;;;;"}
1
+ {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { z } from 'zod';\n\nimport { OpaqueFormField, FormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: { id: 'api:scaffolder/form-fields', input: 'formFields' },\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,yBAAA,GAA4B,sBAEhC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,EACzD,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,4BAAA,EAA8B,OAAO,YAAa,EAAA;AAAA,EAClE,QAAU,EAAA;AAAA,IACR,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAA6C,EAAA;AACpD,IAAM,MAAA,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA;AAEhD,CAAC;AAMM,SAAS,gBAGd,IAAmE,EAAA;AACnE,EAAO,OAAA,eAAA,CAAgB,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA;AAClD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA,KAAA;AAAA;AAAA,KACb;AAAA,GACF;AACF,CAAE,CAAA,CAAA,CAAA;AAMW,MAAA,wBAAA,GAA2B,CAKtC,KACG,KAAA;AACH,EAAM,MAAA,EAAE,EAAI,EAAA,WAAA,EAAgB,GAAA,KAAA,CAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,WAAW,OAAQ,CAAA,mBAAA;AAAA,SAAA;AAAA,OACrB,CAAA;AAAA,KAEJ;AAEA,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAAA,EAC/D,WACH,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA;AAAA;AAAA;AACb;AAEJ,CAAE,CAAA,CAAA;AAMW,MAAA,wBAAA,GAA2B,CAKtC,KACG,KAAA;AACH,EAAM,MAAA,EAAE,EAAI,EAAA,WAAA,EAAgB,GAAA,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,WAAW,OAAQ,CAAA;AAAA;AAAA,OACrB;AAAA;AAIJ,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAAA,EAC/D,WACH,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"],"names":[],"mappings":";;;;AAiCa,MAAA,aAAA,GAAgB,CAK3B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,EAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,aAAsB,QAAQ,CAAA,CAAA;AAChD,EAAA,MAAM,wBAA2B,GAAA,WAAA,CAK/B,0BAA4B,EAAA,QAAA,EAAU,SAAS,CAAA,CAAA;AAEjD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,2CAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,MAAA,MAAW,QAAS,CAAA,CAAA;AAAA,GACpD;AACA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,EAAA;AAAA,MACA,KAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,YAAA;AAAA,QACA,SAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,cAAA;AAAA,QACA,MAAA;AAAA,QACA,QAAA;AAAA,OAAA;AAAA,MAEC,QAAA;AAAA,KACH;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"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.js","sources":["../../../../src/next/components/Form/Form.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { withTheme } from '@rjsf/core';\nimport React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport { ScaffolderRJSFFormProps } from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\n\nconst WrappedForm = withTheme(MuiTheme);\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (props: PropsWithChildren<ScaffolderRJSFFormProps>) => {\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(props.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [props.fields],\n );\n\n const templates = React.useMemo(\n () => ({\n FieldTemplate,\n DescriptionFieldTemplate,\n ...props.templates,\n }),\n [props.templates],\n );\n\n return (\n <WrappedForm {...props} templates={templates} fields={wrappedFields} />\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;AAyBA,MAAM,WAAA,GAAc,UAAUA,KAAQ,CAAA,CAAA;AAMzB,MAAA,IAAA,GAAO,CAAC,KAAsD,KAAA;AAGzE,EAAA,MAAM,gBAAgB,KAAM,CAAA,OAAA;AAAA,IAC1B,MACE,MAAO,CAAA,WAAA;AAAA,MACL,MAAO,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,IAAU,EAAE,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,GAAK,EAAA,SAAS,CAAM,KAAA;AAAA,QAC3D,GAAA;AAAA,QACA,CAAC,YAA6B,KAAA;AAC5B,UACE,uBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,YAAA;AAAA,cACJ,QAAA,EAAU,YAAa,CAAA,QAAA,IAAY,EAAC;AAAA,cACpC,UAAU,YAAa,CAAA,QAAA;AAAA,cACvB,SAAA,EAAW,YAAa,CAAA,SAAA,IAAa,EAAC;AAAA,cACtC,QAAA,EAAU,aAAa,QAAY,IAAA,KAAA;AAAA,cACnC,QAAA,EAAU,aAAa,QAAY,IAAA,KAAA;AAAA,aAAA;AAAA,WACrC,CAAA;AAAA,SAEJ;AAAA,OACD,CAAA;AAAA,KACH;AAAA,IACF,CAAC,MAAM,MAAM,CAAA;AAAA,GACf,CAAA;AAEA,EAAA,MAAM,YAAY,KAAM,CAAA,OAAA;AAAA,IACtB,OAAO;AAAA,MACL,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,KAAM,CAAA,SAAA;AAAA,KACX,CAAA;AAAA,IACA,CAAC,MAAM,SAAS,CAAA;AAAA,GAClB,CAAA;AAEA,EAAA,2CACG,WAAa,EAAA,EAAA,GAAG,KAAO,EAAA,SAAA,EAAsB,QAAQ,aAAe,EAAA,CAAA,CAAA;AAEzE;;;;"}
1
+ {"version":3,"file":"Form.esm.js","sources":["../../../../src/next/components/Form/Form.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { withTheme } from '@rjsf/core';\nimport React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport { ScaffolderRJSFFormProps } from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\n\nconst WrappedForm = withTheme(MuiTheme);\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (props: PropsWithChildren<ScaffolderRJSFFormProps>) => {\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(props.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [props.fields],\n );\n\n const templates = React.useMemo(\n () => ({\n FieldTemplate,\n DescriptionFieldTemplate,\n ...props.templates,\n }),\n [props.templates],\n );\n\n return (\n <WrappedForm {...props} templates={templates} fields={wrappedFields} />\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;AAyBA,MAAM,WAAA,GAAc,UAAUA,KAAQ,CAAA;AAMzB,MAAA,IAAA,GAAO,CAAC,KAAsD,KAAA;AAGzE,EAAA,MAAM,gBAAgB,KAAM,CAAA,OAAA;AAAA,IAC1B,MACE,MAAO,CAAA,WAAA;AAAA,MACL,MAAO,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,IAAU,EAAE,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,GAAK,EAAA,SAAS,CAAM,KAAA;AAAA,QAC3D,GAAA;AAAA,QACA,CAAC,YAA6B,KAAA;AAC5B,UACE,uBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,YAAA;AAAA,cACJ,QAAA,EAAU,YAAa,CAAA,QAAA,IAAY,EAAC;AAAA,cACpC,UAAU,YAAa,CAAA,QAAA;AAAA,cACvB,SAAA,EAAW,YAAa,CAAA,SAAA,IAAa,EAAC;AAAA,cACtC,QAAA,EAAU,aAAa,QAAY,IAAA,KAAA;AAAA,cACnC,QAAA,EAAU,aAAa,QAAY,IAAA;AAAA;AAAA,WACrC;AAAA;AAEJ,OACD;AAAA,KACH;AAAA,IACF,CAAC,MAAM,MAAM;AAAA,GACf;AAEA,EAAA,MAAM,YAAY,KAAM,CAAA,OAAA;AAAA,IACtB,OAAO;AAAA,MACL,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,KAAM,CAAA;AAAA,KACX,CAAA;AAAA,IACA,CAAC,MAAM,SAAS;AAAA,GAClB;AAEA,EAAA,2CACG,WAAa,EAAA,EAAA,GAAG,KAAO,EAAA,SAAA,EAAsB,QAAQ,aAAe,EAAA,CAAA;AAEzE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent\n content=\"This widget is insecure. Please use [`ui:field: Secret`](https://backstage.io/docs/features/software-templates/writing-templates/#using-secrets) instead of\n `ui:widget: password`\"\n />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM,EAAA;AAAA,GACd,GAAA,KAAA,CAAA;AAEJ,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA,CAAA;AAAA,OACzB;AAAA,MACA,KAAA;AAAA,MACA,YAAa,EAAA,KAAA;AAAA,KAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,8LAAA;AAAA,KAAA;AAAA,GAGZ,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent\n content=\"This widget is insecure. Please use [`ui:field: Secret`](https://backstage.io/docs/features/software-templates/writing-templates/#using-secrets) instead of\n `ui:widget: password`\"\n />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM;AAAA,GACd,GAAA,KAAA;AAEJ,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,OACzB;AAAA,MACA,KAAA;AAAA,MACA,YAAa,EAAA;AAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA;AAAA;AAAA,GAGZ,CACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n key;\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLocaleLowerCase('en-us') === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n const schema = findSchemaForKey(key, props.schemas, props.formState);\n return schema\n ? processSchema(key, value, schema, props.formState)\n : [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n const options = {\n titleFormat: formatKey,\n };\n return <StructuredMetadataTable metadata={reviewData} options={options} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA+BA,SAAS,aACP,CAAA,GAAA,EACA,KACA,EAAA,MAAA,EACA,SACmC,EAAA;AACnC,EAAA,MAAM,YAAe,GAAA,IAAIA,OAAW,CAAA,MAAA,CAAO,YAAY,CAAA,CAAA;AACvD,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,C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CAAC,CAAC,SAAW,EAAA,WAAW,CAC3D,KAAA,aAAA,CAAc,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAI,CAAA,EAAA,WAAA,EAAa,QAAQ,SAAS,CAAA;AAAA,OACrE,CAAA;AAAA,KACF;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,CAAC,IAAM,EAAA,KAAK,CAAC,CAAA,CAAA;AACvB,CAAA;AAMa,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAA,MAAM,aAAa,MAAO,CAAA,WAAA;AAAA,IACxB,MAAA,CAAO,OAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,CAC3B,QAAQ,CAAC,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AACzB,MAAA,MAAM,SAAS,gBAAiB,CAAA,GAAA,EAAK,KAAM,CAAA,OAAA,EAAS,MAAM,SAAS,CAAA,CAAA;AACnE,MAAA,OAAO,MACH,GAAA,aAAA,CAAc,GAAK,EAAA,KAAA,EAAO,MAAQ,EAAA,KAAA,CAAM,SAAS,CAAA,GACjD,CAAC,CAAC,GAAK,EAAA,KAAK,CAAC,CAAA,CAAA;AAAA,KAClB,CACA,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,GACnC,CAAA;AACA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,WAAa,EAAA,SAAA;AAAA,GACf,CAAA;AACA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,CAAA,CAAA;AAC1E;;;;"}
1
+ {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n key;\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLocaleLowerCase('en-us') === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n const schema = findSchemaForKey(key, props.schemas, props.formState);\n return schema\n ? processSchema(key, value, schema, props.formState)\n : [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n const options = {\n titleFormat: formatKey,\n };\n return <StructuredMetadataTable metadata={reviewData} options={options} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA+BA,SAAS,aACP,CAAA,GAAA,EACA,KACA,EAAA,MAAA,EACA,SACmC,EAAA;AACnC,EAAA,MAAM,YAAe,GAAA,IAAIA,OAAW,CAAA,MAAA,CAAO,YAAY,CAAA;AACvD,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,CAAA;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAM,EAAA;AAAA,GACP,CAAA;AAED,EAAA,MAAM,OACJ,kBAAqB,GAAA,cAAc,GAAG,MAAQ,EAAA,IAAA,IAC9C,oBAAoB,KACpB,IAAA,GAAA;AAEF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAM,MAAA,sBAAA,GAAyB,kBAAmB,CAAA,cAAc,CAAG,EAAA,MAAA;AACnE,IAAA,IAAI,sBAAwB,EAAA;AAC1B,MAAA,IAAI,uBAAuB,IAAM,EAAA;AAC/B,QAAA,OAAO,CAAC,CAAC,IAAM,EAAA,sBAAA,CAAuB,IAAI,CAAC,CAAA;AAAA;AAE7C,MAAI,IAAA,sBAAA,CAAuB,SAAS,KAAO,EAAA;AACzC,QAAA,OAAO,EAAC;AAAA;AACV;AAGF,IACE,IAAA,kBAAA,CAAmB,WAAW,CAAA,KAAM,UACpC,IAAA,kBAAA,CAAmB,UAAU,CAAG,EAAA,iBAAA,CAAkB,OAAO,CAAA,KAAM,QAC/D,EAAA;AACA,MAAA,OAAO,CAAC,CAAC,IAAM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,IACd,WAAa,EAAA;AAAA,GACf;AACA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,CAAA;AAC1E;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { startCase } from 'lodash';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to format a key into a human-readable string\nexport function formatKey(key: string): string {\n const parts = key.split('/');\n return parts\n .filter(Boolean)\n .map(part => startCase(part))\n .join(' > ');\n}\n\nexport function findSchemaForKey(\n key: string,\n schemas: ParsedTemplateSchema[],\n formState: Partial<{ [key: string]: JsonValue }>,\n): ParsedTemplateSchema | null {\n for (const step of schemas) {\n /*\n To determine if a key is defined in a schema we need to call getSchema\n with an empty form state. Otherwise, it will never return undefined as it\n will fallback to a default schema based on the form state. \n\n An exception to this is when your schema is dynamic i.e. using dependencies \n because the form state is required for generating the schema. In this case,\n we add only the dependencies data to the getSchema call.\n */\n\n const schema = step.mergedSchema;\n\n // Declare data to be a subset of formState\n const data: typeof formState = {};\n\n if (schema.dependencies && isJsonObject(schema.dependencies)) {\n for (const dep in schema.dependencies) {\n if (formState.hasOwnProperty(dep)) {\n data[dep] = formState[dep]; // Add each dependency key from formState\n }\n }\n }\n\n const draft = new JSONSchema(schema);\n const res = draft.getSchema({\n pointer: `#/${key}`,\n data,\n });\n\n if (!!res) {\n return step;\n }\n }\n\n return null; // Return null if the key isn't found in any schema\n}\n"],"names":["JSONSchema"],"mappings":";;;AAqBO,SAAS,aAAa,KAAwC,EAAA;AACnE,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA,CAAA;AAC5E,CAAA;AAGO,SAAS,UAAU,GAAqB,EAAA;AAC7C,EAAM,MAAA,KAAA,GAAQ,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAC3B,EAAO,OAAA,KAAA,CACJ,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,SAAA,CAAU,IAAI,CAAC,CAC3B,CAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AACf,CAAA;AAEgB,SAAA,gBAAA,CACd,GACA,EAAA,OAAA,EACA,SAC6B,EAAA;AAC7B,EAAA,KAAA,MAAW,QAAQ,OAAS,EAAA;AAW1B,IAAA,MAAM,SAAS,IAAK,CAAA,YAAA,CAAA;AAGpB,IAAA,MAAM,OAAyB,EAAC,CAAA;AAEhC,IAAA,IAAI,MAAO,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAA,CAAO,YAAY,CAAG,EAAA;AAC5D,MAAW,KAAA,MAAA,GAAA,IAAO,OAAO,YAAc,EAAA;AACrC,QAAI,IAAA,SAAA,CAAU,cAAe,CAAA,GAAG,CAAG,EAAA;AACjC,UAAK,IAAA,CAAA,GAAG,CAAI,GAAA,SAAA,CAAU,GAAG,CAAA,CAAA;AAAA,SAC3B;AAAA,OACF;AAAA,KACF;AAEA,IAAM,MAAA,KAAA,GAAQ,IAAIA,OAAA,CAAW,MAAM,CAAA,CAAA;AACnC,IAAM,MAAA,GAAA,GAAM,MAAM,SAAU,CAAA;AAAA,MAC1B,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,MACjB,IAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAI,IAAA,CAAC,CAAC,GAAK,EAAA;AACT,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACF;AAEA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { startCase } from 'lodash';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to format a key into a human-readable string\nexport function formatKey(key: string): string {\n const parts = key.split('/');\n return parts\n .filter(Boolean)\n .map(part => startCase(part))\n .join(' > ');\n}\n\nexport function findSchemaForKey(\n key: string,\n schemas: ParsedTemplateSchema[],\n formState: Partial<{ [key: string]: JsonValue }>,\n): ParsedTemplateSchema | null {\n for (const step of schemas) {\n /*\n To determine if a key is defined in a schema we need to call getSchema\n with an empty form state. Otherwise, it will never return undefined as it\n will fallback to a default schema based on the form state. \n\n An exception to this is when your schema is dynamic i.e. using dependencies \n because the form state is required for generating the schema. In this case,\n we add only the dependencies data to the getSchema call.\n */\n\n const schema = step.mergedSchema;\n\n // Declare data to be a subset of formState\n const data: typeof formState = {};\n\n if (schema.dependencies && isJsonObject(schema.dependencies)) {\n for (const dep in schema.dependencies) {\n if (formState.hasOwnProperty(dep)) {\n data[dep] = formState[dep]; // Add each dependency key from formState\n }\n }\n }\n\n const draft = new JSONSchema(schema);\n const res = draft.getSchema({\n pointer: `#/${key}`,\n data,\n });\n\n if (!!res) {\n return step;\n }\n }\n\n return null; // Return null if the key isn't found in any schema\n}\n"],"names":["JSONSchema"],"mappings":";;;AAqBO,SAAS,aAAa,KAAwC,EAAA;AACnE,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAGO,SAAS,UAAU,GAAqB,EAAA;AAC7C,EAAM,MAAA,KAAA,GAAQ,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA;AAC3B,EAAO,OAAA,KAAA,CACJ,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,SAAA,CAAU,IAAI,CAAC,CAC3B,CAAA,IAAA,CAAK,KAAK,CAAA;AACf;AAEgB,SAAA,gBAAA,CACd,GACA,EAAA,OAAA,EACA,SAC6B,EAAA;AAC7B,EAAA,KAAA,MAAW,QAAQ,OAAS,EAAA;AAW1B,IAAA,MAAM,SAAS,IAAK,CAAA,YAAA;AAGpB,IAAA,MAAM,OAAyB,EAAC;AAEhC,IAAA,IAAI,MAAO,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAA,CAAO,YAAY,CAAG,EAAA;AAC5D,MAAW,KAAA,MAAA,GAAA,IAAO,OAAO,YAAc,EAAA;AACrC,QAAI,IAAA,SAAA,CAAU,cAAe,CAAA,GAAG,CAAG,EAAA;AACjC,UAAK,IAAA,CAAA,GAAG,CAAI,GAAA,SAAA,CAAU,GAAG,CAAA;AAAA;AAC3B;AACF;AAGF,IAAM,MAAA,KAAA,GAAQ,IAAIA,OAAA,CAAW,MAAM,CAAA;AACnC,IAAM,MAAA,GAAA,GAAM,MAAM,SAAU,CAAA;AAAA,MAC1B,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,MACjB;AAAA,KACD,CAAA;AAED,IAAI,IAAA,CAAC,CAAC,GAAK,EAAA;AACT,MAAO,OAAA,IAAA;AAAA;AACT;AAGF,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScaffolderField.esm.js","sources":["../../../../src/next/components/ScaffolderField/ScaffolderField.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren, ReactElement } from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/**\n * Props for the {@link ScaffolderField} component\n * @alpha\n */\nexport interface ScaffolderFieldProps {\n rawDescription?: string;\n errors?: ReactElement;\n rawErrors?: string[];\n help?: ReactElement;\n rawHelp?: string;\n required?: boolean;\n disabled?: boolean;\n displayLabel?: boolean;\n}\n\n/**\n * A component to wrap up a input field which helps with formatting and supporting markdown\n * on the field types\n * @alpha\n */\nexport const ScaffolderField = (\n props: PropsWithChildren<ScaffolderFieldProps>,\n) => {\n const {\n children,\n displayLabel = true,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n required,\n disabled,\n } = props;\n const classes = useStyles();\n return (\n <FormControl\n fullWidth\n error={rawErrors.length ? true : false}\n required={required}\n disabled={disabled}\n >\n {children}\n {displayLabel && rawDescription ? (\n <MarkdownContent\n content={rawDescription}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n ) : null}\n {errors}\n {help}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA,KAAA;AAAA;AAAA,KACb;AAAA,GACF;AACF,CAAE,CAAA,CAAA,CAAA;AAsBW,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAe,GAAA,IAAA;AAAA,IACf,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,KAAA,EAAO,SAAU,CAAA,MAAA,GAAS,IAAO,GAAA,KAAA;AAAA,MACjC,QAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,IAEC,QAAA;AAAA,IACA,gBAAgB,cACf,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,cAAA;AAAA,QACT,UAAW,EAAA,QAAA;AAAA,QACX,WAAW,OAAQ,CAAA,mBAAA;AAAA,OAAA;AAAA,KAEnB,GAAA,IAAA;AAAA,IACH,MAAA;AAAA,IACA,IAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScaffolderField.esm.js","sources":["../../../../src/next/components/ScaffolderField/ScaffolderField.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren, ReactElement } from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/**\n * Props for the {@link ScaffolderField} component\n * @alpha\n */\nexport interface ScaffolderFieldProps {\n rawDescription?: string;\n errors?: ReactElement;\n rawErrors?: string[];\n help?: ReactElement;\n rawHelp?: string;\n required?: boolean;\n disabled?: boolean;\n displayLabel?: boolean;\n}\n\n/**\n * A component to wrap up a input field which helps with formatting and supporting markdown\n * on the field types\n * @alpha\n */\nexport const ScaffolderField = (\n props: PropsWithChildren<ScaffolderFieldProps>,\n) => {\n const {\n children,\n displayLabel = true,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n required,\n disabled,\n } = props;\n const classes = useStyles();\n return (\n <FormControl\n fullWidth\n error={rawErrors.length ? true : false}\n required={required}\n disabled={disabled}\n >\n {children}\n {displayLabel && rawDescription ? (\n <MarkdownContent\n content={rawDescription}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n ) : null}\n {errors}\n {help}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA;AAAA;AAAA;AACb;AAEJ,CAAE,CAAA,CAAA;AAsBW,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAe,GAAA,IAAA;AAAA,IACf,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,KAAA,EAAO,SAAU,CAAA,MAAA,GAAS,IAAO,GAAA,KAAA;AAAA,MACjC,QAAA;AAAA,MACA;AAAA,KAAA;AAAA,IAEC,QAAA;AAAA,IACA,gBAAgB,cACf,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,cAAA;AAAA,QACT,UAAW,EAAA,QAAA;AAAA,QACX,WAAW,OAAQ,CAAA;AAAA;AAAA,KAEnB,GAAA,IAAA;AAAA,IACH,MAAA;AAAA,IACA;AAAA,GACH;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScaffolderPageContextMenu.esm.js","sources":["../../../../src/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Description from '@material-ui/icons/Description';\nimport Edit from '@material-ui/icons/Edit';\nimport List from '@material-ui/icons/List';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport React, { useState } from 'react';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { taskReadPermission } from '@backstage/plugin-scaffolder-common/alpha';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n color: theme.page.fontColor,\n },\n}));\n\n/**\n * @alpha\n */\nexport type ScaffolderPageContextMenuProps = {\n onEditorClicked?: () => void;\n onActionsClicked?: () => void;\n onTasksClicked?: () => void;\n onCreateClicked?: () => void;\n};\n\n/**\n * @alpha\n */\nexport function ScaffolderPageContextMenu(\n props: ScaffolderPageContextMenuProps,\n) {\n const { onEditorClicked, onActionsClicked, onTasksClicked, onCreateClicked } =\n props;\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n\n const { allowed: canReadTasks } = usePermission({\n permission: taskReadPermission,\n });\n\n if (!onEditorClicked && !onActionsClicked) {\n return null;\n }\n\n const onOpen = (event: React.SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <>\n <IconButton\n id=\"long-menu\"\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-expanded={!!anchorEl}\n aria-haspopup=\"true\"\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n color=\"inherit\"\n className={classes.button}\n >\n <MoreVert />\n </IconButton>\n <Popover\n aria-labelledby=\"long-menu\"\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n >\n <MenuList>\n {onCreateClicked && (\n <MenuItem onClick={onCreateClicked}>\n <ListItemIcon>\n <CreateComponentIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Create\" />\n </MenuItem>\n )}\n {onEditorClicked && (\n <MenuItem onClick={onEditorClicked}>\n <ListItemIcon>\n <Edit fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Manage Templates\" />\n </MenuItem>\n )}\n {onActionsClicked && (\n <MenuItem onClick={onActionsClicked}>\n <ListItemIcon>\n <Description fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Installed Actions\" />\n </MenuItem>\n )}\n {onTasksClicked && canReadTasks && (\n <MenuItem onClick={onTasksClicked}>\n <ListItemIcon>\n <List fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Task List\" />\n </MenuItem>\n )}\n </MenuList>\n </Popover>\n </>\n );\n}\n"],"names":["Description"],"mappings":";;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,I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ACjB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,QAAS,EAAA,OAAA,EAAQ,CACzB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,OAAQ,EAAA,WAAA,EAAY,CACpC,CAEJ,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScaffolderPageContextMenu.esm.js","sources":["../../../../src/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Description from '@material-ui/icons/Description';\nimport Edit from '@material-ui/icons/Edit';\nimport List from '@material-ui/icons/List';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport React, { useState } from 'react';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { taskReadPermission } from '@backstage/plugin-scaffolder-common/alpha';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n color: theme.page.fontColor,\n },\n}));\n\n/**\n * @alpha\n */\nexport type ScaffolderPageContextMenuProps = {\n onEditorClicked?: () => void;\n onActionsClicked?: () => void;\n onTasksClicked?: () => void;\n onCreateClicked?: () => void;\n};\n\n/**\n * @alpha\n */\nexport function ScaffolderPageContextMenu(\n props: ScaffolderPageContextMenuProps,\n) {\n const { onEditorClicked, onActionsClicked, onTasksClicked, onCreateClicked } =\n props;\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n\n const { allowed: canReadTasks } = usePermission({\n permission: taskReadPermission,\n });\n\n if (!onEditorClicked && !onActionsClicked) {\n return null;\n }\n\n const onOpen = (event: React.SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <>\n <IconButton\n id=\"long-menu\"\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-expanded={!!anchorEl}\n aria-haspopup=\"true\"\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n color=\"inherit\"\n className={classes.button}\n >\n <MoreVert />\n </IconButton>\n <Popover\n aria-labelledby=\"long-menu\"\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n >\n <MenuList>\n {onCreateClicked && (\n <MenuItem onClick={onCreateClicked}>\n <ListItemIcon>\n <CreateComponentIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Create\" />\n </MenuItem>\n )}\n {onEditorClicked && (\n <MenuItem onClick={onEditorClicked}>\n <ListItemIcon>\n <Edit fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Manage Templates\" />\n </MenuItem>\n )}\n {onActionsClicked && (\n <MenuItem onClick={onActionsClicked}>\n <ListItemIcon>\n <Description fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Installed Actions\" />\n </MenuItem>\n )}\n {onTasksClicked && canReadTasks && (\n <MenuItem onClick={onTasksClicked}>\n <ListItemIcon>\n <List fontSize=\"small\" />\n </ListIt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AAA,EAAQ,qBAAoB,CAC5C,CAAA,EAED,cAAkB,IAAA,YAAA,wCAChB,QAAS,EAAA,EAAA,OAAA,EAAS,cACjB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,QAAS,EAAA,OAAA,EAAQ,CACzB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,OAAQ,EAAA,WAAA,EAAY,CACpC,CAEJ;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<\n WidgetProps,\n 'name' | 'onChange' | 'schema' | 'required' | 'disabled'\n >,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, minLength, maxLength },\n required,\n disabled,\n } = props;\n\n return (\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n required={required}\n disabled={disabled}\n inputProps={{\n minLength,\n maxLength,\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,YAAA,GAAe,CAC1B,KAIG,KAAA;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAQ,EAAA,EAAE,KAAO,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IACtC,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,CAAO,KAAM,CAAA,MAAM,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAE,IAAK,CAAA,EAAE,CAAC,CAAA,CAAA;AACxD,QAAA,UAAA,CAAW,EAAE,CAAC,IAAI,GAAG,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,OACvC;AAAA,MACA,KAAA,EAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,EAAA;AAAA,MACxB,IAAK,EAAA,UAAA;AAAA,MACL,YAAa,EAAA,KAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,SAAA;AAAA,QACA,SAAA;AAAA,OACF;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<\n WidgetProps,\n 'name' | 'onChange' | 'schema' | 'required' | 'disabled'\n >,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, minLength, maxLength },\n required,\n disabled,\n } = props;\n\n return (\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n required={required}\n disabled={disabled}\n inputProps={{\n minLength,\n maxLength,\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,YAAA,GAAe,CAC1B,KAIG,KAAA;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,kBAAmB,EAAA;AACnD,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAQ,EAAA,EAAE,KAAO,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IACtC,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,CAAO,KAAM,CAAA,MAAM,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAE,IAAK,CAAA,EAAE,CAAC,CAAA;AACxD,QAAA,UAAA,CAAW,EAAE,CAAC,IAAI,GAAG,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,OACvC;AAAA,MACA,KAAA,EAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,EAAA;AAAA,MACxB,IAAK,EAAA,UAAA;AAAA,MACL,YAAa,EAAA,KAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,SAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"errorListTemplate.esm.js","sources":["../../../../../src/next/components/Stepper/ErrorListTemplate/errorListTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ErrorListProps, RJSFValidationError } from '@rjsf/utils';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport { Theme, createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport startCase from 'lodash/startCase';\n\nconst useStyles = makeStyles((_theme: Theme) =>\n createStyles({\n list: {\n width: '100%',\n },\n text: {\n textWrap: 'wrap',\n },\n }),\n);\n\n/**\n * Shows a list of errors found in the form\n *\n * @public\n */\nexport const ErrorListTemplate = ({ errors, schema }: ErrorListProps) => {\n const classes = useStyles();\n\n function formatErrorMessage(error: RJSFValidationError) {\n if (error.property && error.message) {\n const propertyName = error.property.startsWith('.')\n ? error.property.substring(1)\n : error.property;\n if (schema.properties && propertyName in schema.properties) {\n const property = schema.properties[propertyName];\n\n if (typeof property === 'object' && 'title' in property) {\n return `'${property.title}' ${error.message}`;\n }\n }\n // fall back to property name\n return `'${startCase(propertyName)}' ${error.message}`;\n }\n // fall back if property does not exist\n return error.stack;\n }\n\n return (\n <Paper>\n <List dense className={classes.list}>\n {errors.map((error, index) => (\n <ListItem key={index}>\n <ListItemIcon>\n <ErrorIcon color=\"error\" />\n </ListItemIcon>\n <ListItemText\n classes={{ primary: classes.text }}\n primary={formatErrorMessage(error)}\n />\n </ListItem>\n ))}\n </List>\n </Paper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA0BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,WAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,KAAO,EAAA,MAAA;AAAA,KACT;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAOO,MAAM,iBAAoB,GAAA,CAAC,EAAE,MAAA,EAAQ,QAA6B,KAAA;AACvE,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,SAAS,mBAAmB,KAA4B,EAAA;AACtD,IAAI,IAAA,KAAA,CAAM,QAAY,IAAA,KAAA,CAAM,OAAS,EAAA;AACnC,MAAM,MAAA,YAAA,GAAe,KAAM,CAAA,QAAA,CAAS,UAAW,CAAA,GAAG,CAC9C,GAAA,KAAA,CAAM,QAAS,CAAA,SAAA,CAAU,CAAC,CAAA,GAC1B,KAAM,CAAA,QAAA,CAAA;AACV,MAA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.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ErrorListProps, RJSFValidationError } from '@rjsf/utils';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport { Theme, createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport startCase from 'lodash/startCase';\n\nconst useStyles = makeStyles((_theme: Theme) =>\n createStyles({\n list: {\n width: '100%',\n },\n text: {\n textWrap: 'wrap',\n },\n }),\n);\n\n/**\n * Shows a list of errors found in the form\n *\n * @public\n */\nexport const ErrorListTemplate = ({ errors, schema }: ErrorListProps) => {\n const classes = useStyles();\n\n function formatErrorMessage(error: RJSFValidationError) {\n if (error.property && error.message) {\n const propertyName = error.property.startsWith('.')\n ? error.property.substring(1)\n : error.property;\n if (schema.properties && propertyName in schema.properties) {\n const property = schema.properties[propertyName];\n\n if (typeof property === 'object' && 'title' in property) {\n return `'${property.title}' ${error.message}`;\n }\n }\n // fall back to property name\n return `'${startCase(propertyName)}' ${error.message}`;\n }\n // fall back if property does not exist\n return error.stack;\n }\n\n return (\n <Paper>\n <List dense className={classes.list}>\n {errors.map((error, index) => (\n <ListItem key={index}>\n <ListItemIcon>\n <ErrorIcon color=\"error\" />\n </ListItemIcon>\n <ListItemText\n classes={{ primary: classes.text }}\n primary={formatErrorMessage(error)}\n />\n </ListItem>\n ))}\n </List>\n </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5B,EAAA,EAAA,MAAA,CAAO,GAAI,CAAA,CAAC,OAAO,KAClB,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,KACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,KAAA,EAAM,OAAQ,EAAA,CAC3B,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,EAAE,OAAS,EAAA,OAAA,CAAQ,IAAK,EAAA;AAAA,MACjC,OAAA,EAAS,mBAAmB,KAAK;AAAA;AAAA,GAErC,CACD,CACH,CACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.esm.js","sources":["../../../../src/next/components/Stepper/Stepper.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport MuiStepper from '@material-ui/core/Stepper';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport Button from '@material-ui/core/Button';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport { type IChangeEvent } from '@rjsf/core';\nimport { ErrorSchema } from '@rjsf/utils';\nimport React, {\n useCallback,\n useMemo,\n useState,\n type ReactNode,\n ComponentType,\n} from 'react';\nimport {\n createAsyncValidators,\n type FormValidation,\n} from './createAsyncValidators';\nimport { ReviewState, type ReviewStateProps } from '../ReviewState';\nimport { useTemplateSchema, useFormDataFromQuery } from '../../hooks';\nimport { customizeValidator } from '@rjsf/validator-ajv8';\nimport { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';\nimport { hasErrors } from './utils';\nimport * as FieldOverrides from './FieldOverrides';\nimport { Form } from '../Form';\nimport {\n TemplateParameterSchema,\n LayoutOptions,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { ErrorListTemplate } from './ErrorListTemplate';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { PasswordWidget } from '../PasswordWidget/PasswordWidget';\nimport ajvErrors from 'ajv-errors';\nimport { merge } from 'lodash';\n\nconst validator = customizeValidator();\najvErrors(validator.ajv);\n\n/** @alpha */\nexport type BackstageTemplateStepperClassKey =\n | 'backButton'\n | 'footer'\n | 'formWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n marginTop: theme.spacing(2),\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n }),\n { name: 'BackstageTemplateStepper' },\n);\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: FieldExtensionOptions<any, any>[];\n /**\n * @deprecated This was only ever used for analytics tracking purposes, which\n * is now handled in the `<Workflow />` component. Passing it in will have no\n * effect.\n */\n templateName?: string;\n formProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n onCreate: (values: Record<string, JsonValue>) => Promise<void>;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;\n backButtonText?: ReactNode;\n createButtonText?: ReactNode;\n reviewButtonText?: ReactNode;\n };\n layouts?: LayoutOptions[];\n};\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (stepperProps: StepperProps) => {\n const { layouts = [], components = {}, ...props } = stepperProps;\n const {\n ReviewStateComponent = ReviewState,\n ReviewStepComponent,\n backButtonText = 'Back',\n createButtonText = 'Create',\n reviewButtonText = 'Review',\n } = components;\n const analytics = useAnalytics();\n const { presentation, steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [isValidating, setIsValidating] = useState(false);\n const [initialState] = useFormDataFromQuery(props.initialState);\n const [stepsState, setStepsState] =\n useState<Record<string, JsonValue>>(initialState);\n\n const [errors, setErrors] = useState<undefined | FormValidation>();\n const styles = useStyles();\n\n const backLabel =\n presentation?.buttonLabels?.backButtonText ?? backButtonText;\n const createLabel =\n presentation?.buttonLabels?.createButtonText ?? createButtonText;\n const reviewLabel =\n presentation?.buttonLabels?.reviewButtonText ?? reviewButtonText;\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const fields = useMemo(\n () => ({ ...FieldOverrides, ...extensions }),\n [extensions],\n );\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = useCallback(() => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n }, [setActiveStep]);\n\n const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });\n\n const {\n formContext: propFormContext,\n uiSchema: propUiSchema,\n liveOmit: _shouldLiveOmit,\n omitExtraData: _shouldOmitExtraData,\n ...restFormProps\n } = props.formProps ?? {};\n\n const handleChange = useCallback(\n (e: IChangeEvent) => {\n setStepsState(current => {\n return { ...current, ...e.formData };\n });\n },\n [setStepsState],\n );\n\n const handleNext = useCallback(\n async ({ formData = {} }: { formData?: Record<string, JsonValue> }) => {\n // The validation should never throw, as the validators are wrapped in a try/catch.\n // This makes it fine to set and unset state without try/catch.\n setErrors(undefined);\n setIsValidating(true);\n\n const returnedValidation = await validation(formData);\n\n setStepsState(current => ({\n ...current,\n ...formData,\n }));\n\n setIsValidating(false);\n\n if (hasErrors(returnedValidation)) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n },\n [validation, analytics],\n );\n\n const mergedUiSchema = merge({}, propUiSchema, currentStep?.uiSchema);\n\n const handleCreate = useCallback(() => {\n props.onCreate(stepsState);\n analytics.captureEvent('click', `${createLabel}`);\n }, [props, stepsState, analytics, createLabel]);\n\n return (\n <>\n {isValidating && <LinearProgress variant=\"indeterminate\" />}\n <MuiStepper\n activeStep={activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {steps.map((step, index) => {\n const isAllowedLabelClick = activeStep > index;\n return (\n <MuiStep key={index}>\n <MuiStepLabel\n aria-label={`Step ${index + 1}`}\n style={{ cursor: isAllowedLabelClick ? 'pointer' : 'default' }}\n onClick={() => {\n if (isAllowedLabelClick) setActiveStep(index);\n }}\n >\n {step.title}\n </MuiStepLabel>\n </MuiStep>\n );\n })}\n <MuiStep>\n <MuiStepLabel>{reviewLabel}</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper}>\n {/* eslint-disable-next-line no-nested-ternary */}\n {activeStep < steps.length ? (\n <Form\n key={activeStep}\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={stepsState}\n formContext={{ ...propFormContext, formData: stepsState }}\n schema={currentStep.schema}\n uiSchema={mergedUiSchema}\n onSubmit={handleNext}\n fields={fields}\n showErrorList=\"top\"\n templates={{ ErrorListTemplate }}\n onChange={handleChange}\n widgets={{ password: PasswordWidget }}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n {...restFormProps}\n >\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1 || isValidating}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={isValidating}\n >\n {activeStep === steps.length - 1 ? reviewLabel : 'Next'}\n </Button>\n </div>\n </Form>\n ) : // TODO: potentially move away from this pattern, deprecate?\n ReviewStepComponent ? (\n <ReviewStepComponent\n disableButtons={isValidating}\n formData={stepsState}\n handleBack={handleBack}\n handleReset={() => {}}\n steps={steps}\n handleCreate={handleCreate}\n />\n ) : (\n <>\n <ReviewStateComponent formState={stepsState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handleCreate}\n >\n {createLabel}\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n"],"names":["FieldOverrides","validation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAM,YAAY,kBAAmB,EAAA,CAAA;AACrC,SAAA,CAAU,UAAU,GAAG,CAAA,CAAA;AAQvB,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,UAAY,EAAA;AAAA,MACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAC9B;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA,OAAA;AAAA,MAChB,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAC5B;AAAA,IACA,WAAa,EAAA;AAAA,MACX,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;A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AAAA,MAER,WAAA;AAAA,KAEL,CACF,CAAA;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Stepper.esm.js","sources":["../../../../src/next/components/Stepper/Stepper.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport MuiStepper from '@material-ui/core/Stepper';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport Button from '@material-ui/core/Button';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport { type IChangeEvent } from '@rjsf/core';\nimport { ErrorSchema } from '@rjsf/utils';\nimport React, {\n useCallback,\n useMemo,\n useState,\n type ReactNode,\n ComponentType,\n} from 'react';\nimport {\n createAsyncValidators,\n type FormValidation,\n} from './createAsyncValidators';\nimport { ReviewState, type ReviewStateProps } from '../ReviewState';\nimport { useTemplateSchema, useFormDataFromQuery } from '../../hooks';\nimport { customizeValidator } from '@rjsf/validator-ajv8';\nimport { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';\nimport { hasErrors } from './utils';\nimport * as FieldOverrides from './FieldOverrides';\nimport { Form } from '../Form';\nimport {\n TemplateParameterSchema,\n LayoutOptions,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { ErrorListTemplate } from './ErrorListTemplate';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { PasswordWidget } from '../PasswordWidget/PasswordWidget';\nimport ajvErrors from 'ajv-errors';\nimport { merge } from 'lodash';\n\nconst validator = customizeValidator();\najvErrors(validator.ajv);\n\n/** @alpha */\nexport type BackstageTemplateStepperClassKey =\n | 'backButton'\n | 'footer'\n | 'formWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n marginTop: theme.spacing(2),\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n }),\n { name: 'BackstageTemplateStepper' },\n);\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: FieldExtensionOptions<any, any>[];\n /**\n * @deprecated This was only ever used for analytics tracking purposes, which\n * is now handled in the `<Workflow />` component. Passing it in will have no\n * effect.\n */\n templateName?: string;\n formProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n onCreate: (values: Record<string, JsonValue>) => Promise<void>;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;\n backButtonText?: ReactNode;\n createButtonText?: ReactNode;\n reviewButtonText?: ReactNode;\n };\n layouts?: LayoutOptions[];\n};\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (stepperProps: StepperProps) => {\n const { layouts = [], components = {}, ...props } = stepperProps;\n const {\n ReviewStateComponent = ReviewState,\n ReviewStepComponent,\n backButtonText = 'Back',\n createButtonText = 'Create',\n reviewButtonText = 'Review',\n } = components;\n const analytics = useAnalytics();\n const { presentation, steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [isValidating, setIsValidating] = useState(false);\n const [initialState] = useFormDataFromQuery(props.initialState);\n const [stepsState, setStepsState] =\n useState<Record<string, JsonValue>>(initialState);\n\n const [errors, setErrors] = useState<undefined | FormValidation>();\n const styles = useStyles();\n\n const backLabel =\n presentation?.buttonLabels?.backButtonText ?? backButtonText;\n const createLabel =\n presentation?.buttonLabels?.createButtonText ?? createButtonText;\n const reviewLabel =\n presentation?.buttonLabels?.reviewButtonText ?? reviewButtonText;\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const fields = useMemo(\n () => ({ ...FieldOverrides, ...extensions }),\n [extensions],\n );\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = useCallback(() => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n }, [setActiveStep]);\n\n const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });\n\n const {\n formContext: propFormContext,\n uiSchema: propUiSchema,\n liveOmit: _shouldLiveOmit,\n omitExtraData: _shouldOmitExtraData,\n ...restFormProps\n } = props.formProps ?? {};\n\n const handleChange = useCallback(\n (e: IChangeEvent) => {\n setStepsState(current => {\n return { ...current, ...e.formData };\n });\n },\n [setStepsState],\n );\n\n const handleNext = useCallback(\n async ({ formData = {} }: { formData?: Record<string, JsonValue> }) => {\n // The validation should never throw, as the validators are wrapped in a try/catch.\n // This makes it fine to set and unset state without try/catch.\n setErrors(undefined);\n setIsValidating(true);\n\n const returnedValidation = await validation(formData);\n\n setStepsState(current => ({\n ...current,\n ...formData,\n }));\n\n setIsValidating(false);\n\n if (hasErrors(returnedValidation)) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n },\n [validation, analytics],\n );\n\n const mergedUiSchema = merge({}, propUiSchema, currentStep?.uiSchema);\n\n const handleCreate = useCallback(() => {\n props.onCreate(stepsState);\n analytics.captureEvent('click', `${createLabel}`);\n }, [props, stepsState, analytics, createLabel]);\n\n return (\n <>\n {isValidating && <LinearProgress variant=\"indeterminate\" />}\n <MuiStepper\n activeStep={activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {steps.map((step, index) => {\n const isAllowedLabelClick = activeStep > index;\n return (\n <MuiStep key={index}>\n <MuiStepLabel\n aria-label={`Step ${index + 1}`}\n style={{ cursor: isAllowedLabelClick ? 'pointer' : 'default' }}\n onClick={() => {\n if (isAllowedLabelClick) setActiveStep(index);\n }}\n >\n {step.title}\n </MuiStepLabel>\n </MuiStep>\n );\n })}\n <MuiStep>\n <MuiStepLabel>{reviewLabel}</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper}>\n {/* eslint-disable-next-line no-nested-ternary */}\n {activeStep < steps.length ? (\n <Form\n key={activeStep}\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={stepsState}\n formContext={{ ...propFormContext, formData: stepsState }}\n schema={currentStep.schema}\n uiSchema={mergedUiSchema}\n onSubmit={handleNext}\n fields={fields}\n showErrorList=\"top\"\n templates={{ ErrorListTemplate }}\n onChange={handleChange}\n widgets={{ password: PasswordWidget }}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n {...restFormProps}\n >\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1 || isValidating}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={isValidating}\n >\n {activeStep === steps.length - 1 ? reviewLabel : 'Next'}\n </Button>\n </div>\n </Form>\n ) : // TODO: potentially move away from this pattern, deprecate?\n ReviewStepComponent ? (\n <ReviewStepComponent\n disableButtons={isValidating}\n formData={stepsState}\n handleBack={handleBack}\n handleReset={() => {}}\n steps={steps}\n handleCreate={handleCreate}\n />\n ) : (\n <>\n <ReviewStateComponent formState={stepsState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handleCreate}\n >\n {createLabel}\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n"],"names":["FieldOverrides","validation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAM,YAAY,kBAAmB,EAAA;AACrC,SAAA,CAAU,UAAU,GAAG,CAAA;AAQvB,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,UAAY,EAAA;AAAA,MACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KAC9B;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA,OAAA;AAAA,MAChB,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KAC5B;AAAA,IACA,WAAa,EAAA;AAAA,MACX,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAC1B,GACF,CAAA;AAAA,EACA,EAAE,MAAM,0BAA2B;AACrC,CAAA;AAgCa,MAAA,OAAA,GAAU,CAAC,YAA+B,KAAA;AACrD,EAAM,MAAA,EAAE,UAAU,EAAC,EAAG,aAAa,EAAC,EAAG,GAAG,KAAA,EAAU,GAAA,YAAA;AACpD,EAAM,MAAA;AAAA,IACJ,oBAAuB,GAAA,WAAA;AAAA,IACvB,mBAAA;AAAA,IACA,cAAiB,GAAA,MAAA;AAAA,IACjB,gBAAmB,GAAA,QAAA;AAAA,IACnB,gBAAmB,GAAA;AAAA,GACjB,GAAA,UAAA;AACJ,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAA,MAA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