@backstage/plugin-scaffolder-react 1.15.0-next.1 → 1.15.0

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 (71) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/alpha.d.ts +22 -21
  3. package/dist/hooks/useCustomFieldExtensions.esm.js +2 -1
  4. package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
  5. package/dist/index.d.ts +4 -3
  6. package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
  7. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js +3 -3
  8. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  9. package/dist/next/components/Form/FieldTemplate.esm.js +18 -18
  10. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  11. package/dist/next/components/Form/Form.esm.js +6 -5
  12. package/dist/next/components/Form/Form.esm.js.map +1 -1
  13. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js +17 -14
  14. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  15. package/dist/next/components/ReviewState/ReviewState.esm.js +2 -2
  16. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  17. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js +17 -15
  18. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  19. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js +65 -44
  20. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  21. package/dist/next/components/SecretWidget/SecretWidget.esm.js +3 -2
  22. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  23. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js +11 -8
  24. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  25. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js +2 -2
  26. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
  27. package/dist/next/components/Stepper/Stepper.esm.js +106 -90
  28. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  29. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js +3 -3
  30. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  31. package/dist/next/components/TaskSteps/StepIcon.esm.js +10 -10
  32. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  33. package/dist/next/components/TaskSteps/StepTime.esm.js +3 -2
  34. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  35. package/dist/next/components/TaskSteps/TaskBorder.esm.js +3 -3
  36. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  37. package/dist/next/components/TaskSteps/TaskSteps.esm.js +43 -38
  38. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  39. package/dist/next/components/TemplateCard/CardHeader.esm.js +24 -9
  40. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  41. package/dist/next/components/TemplateCard/CardLink.esm.js +5 -2
  42. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  43. package/dist/next/components/TemplateCard/TemplateCard.esm.js +29 -19
  44. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  45. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js +31 -25
  46. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
  47. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js +3 -3
  48. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
  49. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js +35 -29
  50. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
  51. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js +21 -18
  52. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
  53. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js +14 -14
  54. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
  55. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js +44 -41
  56. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  57. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js +14 -11
  58. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  59. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js +14 -8
  60. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  61. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js +33 -27
  62. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  63. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js +4 -4
  64. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  65. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js +8 -8
  66. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  67. package/dist/next/components/Workflow/Workflow.esm.js +27 -23
  68. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  69. package/dist/secrets/SecretsContext.esm.js +6 -5
  70. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  71. package/package.json +21 -21
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5890016: add api to retrieve template extensions info from scaffolder-backend
8
+
9
+ ### Patch Changes
10
+
11
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
12
+
13
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
14
+
15
+ - 6ed42b7: Scaffolding - Template card - button to show template entity detail
16
+ - 7ae9996: Fixes the detail icon in light theme to be visible in proper color (same as favorite star).
17
+ - Updated dependencies
18
+ - @backstage/plugin-catalog-react@1.17.0
19
+ - @backstage/frontend-plugin-api@0.10.1
20
+ - @backstage/core-components@0.17.1
21
+ - @backstage/core-plugin-api@1.10.6
22
+ - @backstage/plugin-permission-react@0.4.33
23
+ - @backstage/theme@0.6.5
24
+ - @backstage/catalog-client@1.9.1
25
+ - @backstage/catalog-model@1.7.3
26
+ - @backstage/types@1.2.1
27
+ - @backstage/version-bridge@1.0.11
28
+ - @backstage/plugin-scaffolder-common@1.5.10
29
+
30
+ ## 1.15.0-next.2
31
+
32
+ ### Patch Changes
33
+
34
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
35
+
36
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
37
+
38
+ - Updated dependencies
39
+ - @backstage/frontend-plugin-api@0.10.1-next.1
40
+ - @backstage/core-components@0.17.1-next.1
41
+ - @backstage/core-plugin-api@1.10.6-next.0
42
+ - @backstage/plugin-permission-react@0.4.33-next.0
43
+ - @backstage/plugin-catalog-react@1.17.0-next.2
44
+ - @backstage/theme@0.6.5-next.0
45
+ - @backstage/catalog-client@1.9.1
46
+ - @backstage/catalog-model@1.7.3
47
+ - @backstage/types@1.2.1
48
+ - @backstage/version-bridge@1.0.11
49
+ - @backstage/plugin-scaffolder-common@1.5.10
50
+
3
51
  ## 1.15.0-next.1
4
52
 
5
53
  ### Patch Changes
package/dist/alpha.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
2
  import { z } from 'zod';
3
3
  import { FieldExtensionComponentProps, CustomFieldValidator, FieldSchema, TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep } from '@backstage/plugin-scaffolder-react';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import { JsonObject, JsonValue } from '@backstage/types';
5
- import * as React from 'react';
6
- import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
6
+ import * as react from 'react';
7
+ import { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
7
8
  import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
8
9
  import { UiSchema, FieldValidation, WidgetProps } from '@rjsf/utils';
9
10
  import { AnyApiRef, ApiHolder, IconComponent } from '@backstage/core-plugin-api';
@@ -192,7 +193,7 @@ type ReviewStateProps = {
192
193
  * The component used by the {@link Stepper} to render the review step.
193
194
  * @alpha
194
195
  */
195
- declare const ReviewState: (props: ReviewStateProps) => React__default.JSX.Element;
196
+ declare const ReviewState: (props: ReviewStateProps) => react_jsx_runtime.JSX.Element;
196
197
 
197
198
  /** @alpha */
198
199
  type BackstageTemplateStepperClassKey = 'backButton' | 'footer' | 'formWrapper';
@@ -225,7 +226,7 @@ type StepperProps = {
225
226
  * The `Stepper` component is the Wizard that is rendered when a user selects a template
226
227
  * @alpha
227
228
  */
228
- declare const Stepper: (stepperProps: StepperProps) => React__default.JSX.Element;
229
+ declare const Stepper: (stepperProps: StepperProps) => react_jsx_runtime.JSX.Element;
229
230
 
230
231
  /** @alpha */
231
232
  type FormValidation = {
@@ -253,7 +254,7 @@ interface TemplateCardProps {
253
254
  * The `TemplateCard` component that is rendered in a list for each template
254
255
  * @alpha
255
256
  */
256
- declare const TemplateCard: (props: TemplateCardProps) => React__default.JSX.Element;
257
+ declare const TemplateCard: (props: TemplateCardProps) => react_jsx_runtime.JSX.Element;
257
258
 
258
259
  /**
259
260
  * The props for the {@link TemplateGroup} component.
@@ -269,16 +270,16 @@ interface TemplateGroupProps {
269
270
  }[];
270
271
  }[];
271
272
  onSelected: (template: TemplateEntityV1beta3) => void;
272
- title: React__default.ReactNode;
273
+ title: ReactNode;
273
274
  components?: {
274
- CardComponent?: React__default.ComponentType<TemplateCardProps>;
275
+ CardComponent?: ComponentType<TemplateCardProps>;
275
276
  };
276
277
  }
277
278
  /**
278
279
  * The `TemplateGroup` component is used to display a group of templates with a title.
279
280
  * @alpha
280
281
  */
281
- declare const TemplateGroup: (props: TemplateGroupProps) => React__default.JSX.Element | null;
282
+ declare const TemplateGroup: (props: TemplateGroupProps) => react_jsx_runtime.JSX.Element | null;
282
283
 
283
284
  /**
284
285
  * @alpha
@@ -286,7 +287,7 @@ declare const TemplateGroup: (props: TemplateGroupProps) => React__default.JSX.E
286
287
  interface TemplateGroupsProps {
287
288
  groups: TemplateGroupFilter[];
288
289
  templateFilter?: (entity: TemplateEntityV1beta3) => boolean;
289
- TemplateCardComponent?: React__default.ComponentType<{
290
+ TemplateCardComponent?: ComponentType<{
290
291
  template: TemplateEntityV1beta3;
291
292
  }>;
292
293
  onTemplateSelected?: (template: TemplateEntityV1beta3) => void;
@@ -299,7 +300,7 @@ interface TemplateGroupsProps {
299
300
  /**
300
301
  * @alpha
301
302
  */
302
- declare const TemplateGroups: (props: TemplateGroupsProps) => React__default.JSX.Element | null;
303
+ declare const TemplateGroups: (props: TemplateGroupsProps) => react_jsx_runtime.JSX.Element | null;
303
304
 
304
305
  /**
305
306
  * @alpha
@@ -310,7 +311,7 @@ type WorkflowProps = {
310
311
  namespace: string;
311
312
  templateName: string;
312
313
  components?: {
313
- ReviewStepComponent?: React__default.ComponentType<ReviewStepProps>;
314
+ ReviewStepComponent?: ComponentType<ReviewStepProps>;
314
315
  };
315
316
  onError(error: Error | undefined): JSX.Element | null;
316
317
  } & Pick<StepperProps, 'extensions' | 'formProps' | 'components' | 'onCreate' | 'initialState' | 'layouts'>;
@@ -321,7 +322,7 @@ declare const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null;
321
322
  /**
322
323
  * @alpha
323
324
  */
324
- declare const EmbeddableWorkflow: (props: WorkflowProps) => React__default.JSX.Element;
325
+ declare const EmbeddableWorkflow: (props: WorkflowProps) => react_jsx_runtime.JSX.Element;
325
326
 
326
327
  /**
327
328
  * The DefaultOutputs renderer for the scaffolder task output
@@ -330,13 +331,13 @@ declare const EmbeddableWorkflow: (props: WorkflowProps) => React__default.JSX.E
330
331
  */
331
332
  declare const DefaultTemplateOutputs: (props: {
332
333
  output?: ScaffolderTaskOutput;
333
- }) => React__default.JSX.Element | null;
334
+ }) => react_jsx_runtime.JSX.Element | null;
334
335
 
335
336
  /**
336
337
  * The Form component
337
338
  * @alpha
338
339
  */
339
- declare const Form: (props: PropsWithChildren<ScaffolderRJSFFormProps>) => React__default.JSX.Element;
340
+ declare const Form: (props: PropsWithChildren<ScaffolderRJSFFormProps>) => react_jsx_runtime.JSX.Element;
340
341
 
341
342
  /**
342
343
  * Props for the TaskSteps component
@@ -354,7 +355,7 @@ interface TaskStepsProps {
354
355
  *
355
356
  * @alpha
356
357
  */
357
- declare const TaskSteps: (props: TaskStepsProps) => React__default.JSX.Element;
358
+ declare const TaskSteps: (props: TaskStepsProps) => react_jsx_runtime.JSX.Element;
358
359
 
359
360
  /**
360
361
  * The text of the event stream
@@ -365,7 +366,7 @@ declare const TaskLogStream: (props: {
365
366
  logs: {
366
367
  [k: string]: string[];
367
368
  };
368
- }) => React__default.JSX.Element;
369
+ }) => react_jsx_runtime.JSX.Element;
369
370
 
370
371
  /** @alpha */
371
372
  type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';
@@ -374,7 +375,7 @@ type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';
374
375
  * categories and filtering the template list.
375
376
  * @alpha
376
377
  */
377
- declare const TemplateCategoryPicker: () => React__default.JSX.Element | null;
378
+ declare const TemplateCategoryPicker: () => react_jsx_runtime.JSX.Element | null;
378
379
 
379
380
  /**
380
381
  * @alpha
@@ -388,7 +389,7 @@ type ScaffolderPageContextMenuProps = {
388
389
  /**
389
390
  * @alpha
390
391
  */
391
- declare function ScaffolderPageContextMenu(props: ScaffolderPageContextMenuProps): React__default.JSX.Element | null;
392
+ declare function ScaffolderPageContextMenu(props: ScaffolderPageContextMenuProps): react_jsx_runtime.JSX.Element | null;
392
393
 
393
394
  /**
394
395
  * Props for the {@link ScaffolderField} component
@@ -409,13 +410,13 @@ interface ScaffolderFieldProps {
409
410
  * on the field types
410
411
  * @alpha
411
412
  */
412
- declare const ScaffolderField: (props: PropsWithChildren<ScaffolderFieldProps>) => React__default.JSX.Element;
413
+ declare const ScaffolderField: (props: PropsWithChildren<ScaffolderFieldProps>) => react_jsx_runtime.JSX.Element;
413
414
 
414
415
  /**
415
416
  * Secret Widget for overriding the default password input widget
416
417
  * @alpha
417
418
  */
418
- declare const SecretWidget: (props: Pick<WidgetProps, "name" | "onChange" | "schema" | "required" | "disabled">) => React__default.JSX.Element;
419
+ declare const SecretWidget: (props: Pick<WidgetProps, "name" | "onChange" | "schema" | "required" | "disabled">) => react_jsx_runtime.JSX.Element;
419
420
 
420
421
  /**
421
422
  * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf
@@ -435,7 +436,7 @@ declare const createFieldValidation: () => FieldValidation;
435
436
  * This hook is used to get the formData from the query string.
436
437
  * @alpha
437
438
  */
438
- declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) => [Record<string, any>, React.Dispatch<React.SetStateAction<Record<string, any>>>];
439
+ declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) => [Record<string, any>, react.Dispatch<react.SetStateAction<Record<string, any>>>];
439
440
 
440
441
  /**
441
442
  * @alpha
@@ -6,13 +6,14 @@ import '../next/components/Stepper/Stepper.esm.js';
6
6
  import 'json-schema-library';
7
7
  import 'flatted';
8
8
  import '../next/components/TemplateCard/TemplateCard.esm.js';
9
- import 'react';
9
+ import 'react/jsx-runtime';
10
10
  import '@backstage/core-components';
11
11
  import 'lodash';
12
12
  import '@backstage/catalog-model';
13
13
  import '@backstage/plugin-catalog-react';
14
14
  import '@backstage/plugin-scaffolder-common';
15
15
  import '@material-ui/core/Typography';
16
+ import 'react';
16
17
  import '../next/components/Workflow/Workflow.esm.js';
17
18
  import '@backstage/frontend-plugin-api';
18
19
  import '@material-ui/core/Box';
@@ -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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useApi, useElementFilter } from '@backstage/core-plugin-api';\nimport { formFieldsApiRef } from '../next';\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 // todo(blam): this shouldn't be here, should remove this, but this is a breaking change to remove the generic.\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n // Get custom fields created with FormFieldBlueprint\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: blueprintFields }, { execute }] = useAsync(\n () => formFieldsApi.getFormFields(),\n [],\n );\n useMountEffect(execute);\n\n // Get custom fields created with ScaffolderFieldExtensions\n const outletFields = 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 // This should really be a different type moving foward, but we do this to keep type compatibility.\n // should probably also move the defaults into the API eventually too, but that will come with the move\n // to the new frontend system.\n const blueprintsToLegacy: FieldExtensionOptions[] = blueprintFields?.map(\n field => ({\n component: field.component,\n name: field.name,\n validation: field.validation,\n schema: field.schema?.schema,\n }),\n );\n\n return [...blueprintsToLegacy, ...outletFields] as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Ba,MAAA,wBAAA,GAA2B,CAItC,MACG,KAAA;AAEH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,CAAC,EAAE,MAAQ,EAAA,eAAA,IAAmB,EAAE,OAAA,EAAS,CAAI,GAAA,QAAA;AAAA,IACjD,MAAM,cAAc,aAAc,EAAA;AAAA,IAClC;AAAC,GACH;AACA,EAAA,cAAA,CAAe,OAAO,CAAA;AAGtB,EAAA,MAAM,YAAe,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AAKA,EAAA,MAAM,qBAA8C,eAAiB,EAAA,GAAA;AAAA,IACnE,CAAU,KAAA,MAAA;AAAA,MACR,WAAW,KAAM,CAAA,SAAA;AAAA,MACjB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAA,EAAQ,MAAM,MAAQ,EAAA;AAAA,KACxB;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,GAAG,kBAAoB,EAAA,GAAG,YAAY,CAAA;AAChD;;;;"}
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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useApi, useElementFilter } from '@backstage/core-plugin-api';\nimport { formFieldsApiRef } from '../next';\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 // todo(blam): this shouldn't be here, should remove this, but this is a breaking change to remove the generic.\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n // Get custom fields created with FormFieldBlueprint\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: blueprintFields }, { execute }] = useAsync(\n () => formFieldsApi.getFormFields(),\n [],\n );\n useMountEffect(execute);\n\n // Get custom fields created with ScaffolderFieldExtensions\n const outletFields = 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 // This should really be a different type moving foward, but we do this to keep type compatibility.\n // should probably also move the defaults into the API eventually too, but that will come with the move\n // to the new frontend system.\n const blueprintsToLegacy: FieldExtensionOptions[] = blueprintFields?.map(\n field => ({\n component: field.component,\n name: field.name,\n validation: field.validation,\n schema: field.schema?.schema,\n }),\n );\n\n return [...blueprintsToLegacy, ...outletFields] as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Ba,MAAA,wBAAA,GAA2B,CAItC,MACG,KAAA;AAEH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,CAAC,EAAE,MAAQ,EAAA,eAAA,IAAmB,EAAE,OAAA,EAAS,CAAI,GAAA,QAAA;AAAA,IACjD,MAAM,cAAc,aAAc,EAAA;AAAA,IAClC;AAAC,GACH;AACA,EAAA,cAAA,CAAe,OAAO,CAAA;AAGtB,EAAA,MAAM,YAAe,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AAKA,EAAA,MAAM,qBAA8C,eAAiB,EAAA,GAAA;AAAA,IACnE,CAAU,KAAA,MAAA;AAAA,MACR,WAAW,KAAM,CAAA,SAAA;AAAA,MACjB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAA,EAAQ,MAAM,MAAQ,EAAA;AAAA,KACxB;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,GAAG,kBAAoB,EAAA,GAAG,YAAY,CAAA;AAChD;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ApiHolder, Extension } from '@backstage/core-plugin-api';
2
- import React__default, { HTMLAttributes, ReactNode, FormEvent, ElementType, Ref, ComponentType, PropsWithChildren } from 'react';
2
+ import { HTMLAttributes, ReactNode, FormEvent, ElementType, Ref, ComponentType, PropsWithChildren } from 'react';
3
3
  import { JsonObject, JsonValue, Observable } from '@backstage/types';
4
4
  import { JSONSchema7 } from 'json-schema';
5
5
  import { StrictRJSFSchema, RJSFSchema, FormContextType, GenericObjectType, UiSchema, IdSchema, ErrorSchema, Registry, ValidatorType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorTransformer, Experimental_DefaultFormStateBehavior, UIOptionsType, FieldValidation } from '@rjsf/utils';
6
6
  import Form, { IChangeEvent, FormProps as FormProps$1 } from '@rjsf/core';
7
7
  import { TemplateEntityV1beta3, TemplatePresentationV1beta3, TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
8
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
9
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
9
10
  import { z } from 'zod';
10
11
 
@@ -359,7 +360,7 @@ type TemplateParameterSchema = {
359
360
  */
360
361
  declare const SecretsContextProvider: (props: PropsWithChildren<{
361
362
  initialSecrets?: Record<string, string>;
362
- }>) => React__default.JSX.Element;
363
+ }>) => react_jsx_runtime.JSX.Element;
363
364
  /**
364
365
  * The return type from the useTemplateSecrets hook.
365
366
  * @public
@@ -683,7 +684,7 @@ declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOp
683
684
  *
684
685
  * @public
685
686
  */
686
- declare const ScaffolderLayouts: React__default.ComponentType<React__default.PropsWithChildren<{}>>;
687
+ declare const ScaffolderLayouts: ComponentType<PropsWithChildren<{}>>;
687
688
 
688
689
  /**
689
690
  * Hook that returns all custom field extensions from the current outlet.
@@ -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;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
+ {"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 { PropsWithChildren, ComponentType } 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: ComponentType<\n 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,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { MarkdownContent } from '@backstage/core-components';
3
3
  import Typography from '@material-ui/core/Typography';
4
4
  import { makeStyles } from '@material-ui/core/styles';
@@ -20,7 +20,7 @@ const DescriptionFieldTemplate = (props) => {
20
20
  const classes = useStyles();
21
21
  if (description) {
22
22
  if (typeof description === "string") {
23
- return /* @__PURE__ */ React.createElement(
23
+ return /* @__PURE__ */ jsx(
24
24
  MarkdownContent,
25
25
  {
26
26
  content: description,
@@ -29,7 +29,7 @@ const DescriptionFieldTemplate = (props) => {
29
29
  }
30
30
  );
31
31
  }
32
- return /* @__PURE__ */ React.createElement(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" } }, description);
32
+ return /* @__PURE__ */ jsx(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: description });
33
33
  }
34
34
  return null;
35
35
  };
@@ -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 linkTarget=\"_blank\"\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,UAAW,EAAA,QAAA;AAAA,UACX,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
+ {"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 { 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 linkTarget=\"_blank\"\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":";;;;;AAyBA,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,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,UAAW,EAAA,QAAA;AAAA,UACX,WAAW,OAAQ,CAAA;AAAA;AAAA,OACrB;AAAA;AAIJ,IACE,uBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAC/D,QACH,EAAA,WAAA,EAAA,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { getUiOptions, getTemplate } from '@rjsf/utils';
3
3
  import { ScaffolderField } from '../ScaffolderField/ScaffolderField.esm.js';
4
4
 
@@ -27,9 +27,9 @@ const FieldTemplate = (props) => {
27
27
  const uiOptions = getUiOptions(uiSchema);
28
28
  const WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
29
29
  if (hidden) {
30
- return /* @__PURE__ */ React.createElement("div", { style: { display: "none" } }, children);
30
+ return /* @__PURE__ */ jsx("div", { style: { display: "none" }, children });
31
31
  }
32
- return /* @__PURE__ */ React.createElement(
32
+ return /* @__PURE__ */ jsx(
33
33
  WrapIfAdditionalTemplate,
34
34
  {
35
35
  classNames,
@@ -43,21 +43,21 @@ const FieldTemplate = (props) => {
43
43
  required,
44
44
  schema,
45
45
  uiSchema,
46
- registry
47
- },
48
- /* @__PURE__ */ React.createElement(
49
- ScaffolderField,
50
- {
51
- displayLabel,
52
- rawErrors,
53
- help,
54
- disabled,
55
- rawDescription,
56
- errors,
57
- required
58
- },
59
- children
60
- )
46
+ registry,
47
+ children: /* @__PURE__ */ jsx(
48
+ ScaffolderField,
49
+ {
50
+ displayLabel,
51
+ rawErrors,
52
+ help,
53
+ disabled,
54
+ rawDescription,
55
+ errors,
56
+ required,
57
+ children
58
+ }
59
+ )
60
+ }
61
61
  );
62
62
  };
63
63
 
@@ -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;AAAA,GACE,GAAA,KAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAA2B,GAAA,WAAA,CAK/B,0BAA4B,EAAA,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,2CAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,MAAA,MAAW,QAAS,CAAA;AAAA;AAEpD,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;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;AAAA,OAAA;AAAA,MAEC;AAAA;AACH,GACF;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 {\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":";;;;AA+Ba,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;AAAA,GACE,GAAA,KAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAA2B,GAAA,WAAA,CAK/B,0BAA4B,EAAA,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,2BAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,MAAA,IAAW,QAAS,EAAA,CAAA;AAAA;AAEpD,EACE,uBAAA,GAAA;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,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;;;;"}
@@ -1,17 +1,18 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { withTheme } from '@rjsf/core';
2
- import React from 'react';
3
+ import { useMemo } from 'react';
3
4
  import { FieldTemplate } from './FieldTemplate.esm.js';
4
5
  import { DescriptionFieldTemplate } from './DescriptionFieldTemplate.esm.js';
5
6
  import { Theme } from '@rjsf/material-ui';
6
7
 
7
8
  const WrappedForm = withTheme(Theme);
8
9
  const Form = (props) => {
9
- const wrappedFields = React.useMemo(
10
+ const wrappedFields = useMemo(
10
11
  () => Object.fromEntries(
11
12
  Object.entries(props.fields ?? {}).map(([key, Component]) => [
12
13
  key,
13
14
  (wrapperProps) => {
14
- return /* @__PURE__ */ React.createElement(
15
+ return /* @__PURE__ */ jsx(
15
16
  Component,
16
17
  {
17
18
  ...wrapperProps,
@@ -27,7 +28,7 @@ const Form = (props) => {
27
28
  ),
28
29
  [props.fields]
29
30
  );
30
- const templates = React.useMemo(
31
+ const templates = useMemo(
31
32
  () => ({
32
33
  FieldTemplate,
33
34
  DescriptionFieldTemplate,
@@ -35,7 +36,7 @@ const Form = (props) => {
35
36
  }),
36
37
  [props.templates]
37
38
  );
38
- return /* @__PURE__ */ React.createElement(WrappedForm, { ...props, templates, fields: wrappedFields });
39
+ return /* @__PURE__ */ jsx(WrappedForm, { ...props, templates, fields: wrappedFields });
39
40
  };
40
41
 
41
42
  export { Form };
@@ -1 +1 @@
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
+ {"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 { useMemo, 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 = 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 = 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":";;;;;;;AAwBA,MAAM,WAAA,GAAc,UAAUA,KAAQ,CAAA;AAMzB,MAAA,IAAA,GAAO,CAAC,KAAsD,KAAA;AAGzE,EAAA,MAAM,aAAgB,GAAA,OAAA;AAAA,IACpB,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,GAAA;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,SAAY,GAAA,OAAA;AAAA,IAChB,OAAO;AAAA,MACL,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,KAAM,CAAA;AAAA,KACX,CAAA;AAAA,IACA,CAAC,MAAM,SAAS;AAAA,GAClB;AAEA,EAAA,2BACG,WAAa,EAAA,EAAA,GAAG,KAAO,EAAA,SAAA,EAAsB,QAAQ,aAAe,EAAA,CAAA;AAEzE;;;;"}
@@ -1,8 +1,8 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
2
  import { MarkdownContent } from '@backstage/core-components';
2
3
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
3
4
  import FormHelperText from '@material-ui/core/FormHelperText';
4
5
  import TextField from '@material-ui/core/TextField';
5
- import React from 'react';
6
6
  import { scaffolderReactTranslationRef } from '../../../translation.esm.js';
7
7
 
8
8
  const PasswordWidget = (props) => {
@@ -12,19 +12,22 @@ const PasswordWidget = (props) => {
12
12
  onChange,
13
13
  schema: { title }
14
14
  } = props;
15
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
16
- TextField,
17
- {
18
- id: title,
19
- label: title,
20
- "aria-describedby": title,
21
- onChange: (e) => {
22
- onChange(e.target.value);
23
- },
24
- value,
25
- autoComplete: "off"
26
- }
27
- ), /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, /* @__PURE__ */ React.createElement(MarkdownContent, { content: t("passwordWidget.content") })));
15
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ /* @__PURE__ */ jsx(
17
+ TextField,
18
+ {
19
+ id: title,
20
+ label: title,
21
+ "aria-describedby": title,
22
+ onChange: (e) => {
23
+ onChange(e.target.value);
24
+ },
25
+ value,
26
+ autoComplete: "off"
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsx(FormHelperText, { error: true, children: /* @__PURE__ */ jsx(MarkdownContent, { content: t("passwordWidget.content") }) })
30
+ ] });
28
31
  };
29
32
 
30
33
  export { PasswordWidget };
@@ -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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\nimport React from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\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 content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAyBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,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,CAAC,eAAgB,EAAA,EAAA,OAAA,EAAS,CAAE,CAAA,wBAAwB,CAAG,EAAA,CACzD,CACF,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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\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 content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM;AAAA,GACd,GAAA,KAAA;AAEJ,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA,KAAA;AAAA,QACJ,KAAO,EAAA,KAAA;AAAA,QACP,kBAAkB,EAAA,KAAA;AAAA,QAClB,UAAU,CAAK,CAAA,KAAA;AACb,UAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,SACzB;AAAA,QACA,KAAA;AAAA,QACA,YAAa,EAAA;AAAA;AAAA,KACf;AAAA,oBACA,GAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAgB,OAAS,EAAA,CAAA,CAAE,wBAAwB,CAAA,EAAG,CACzD,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { StructuredMetadataTable } from '@backstage/core-components';
3
3
  import { Draft07 } from 'json-schema-library';
4
4
  import { findSchemaForKey, isJsonObject, formatKey } from './util.esm.js';
@@ -49,7 +49,7 @@ const ReviewState = (props) => {
49
49
  const options = {
50
50
  titleFormat: formatKey
51
51
  };
52
- return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData, options });
52
+ return /* @__PURE__ */ jsx(StructuredMetadataTable, { metadata: reviewData, options });
53
53
  };
54
54
 
55
55
  export { ReviewState };
@@ -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;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,EAAA,QAAQ,CAAC,CAAA;AAAA;AAG1B,IAAI,IAAA,kBAAA,CAAmB,IAAQ,IAAA,kBAAA,CAAmB,SAAW,EAAA;AAC3D,MAAO,OAAA;AAAA,QACL;AAAA,UACE,IAAA;AAAA,UACA,mBAAmB,SACjB,CAAA,kBAAA,CAAmB,KAAK,OAAQ,CAAA,KAAK,CACvC,CAAK,IAAA;AAAA;AACP,OACF;AAAA;AAGF,IAAA,IAAI,sBAAwB,EAAA,OAAA,KAAY,KAAS,IAAA,YAAA,CAAa,KAAK,CAAG,EAAA;AAEpE,MAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,KAAK,CAAE,CAAA,OAAA;AAAA,QAAQ,CAAC,CAAC,SAAW,EAAA,WAAW,CAC3D,KAAA,aAAA,CAAc,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAI,CAAA,EAAA,WAAA,EAAa,QAAQ,SAAS;AAAA,OACrE;AAAA;AACF;AAGF,EAAA,OAAO,CAAC,CAAC,IAAM,EAAA,KAAK,CAAC,CAAA;AACvB;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;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;AAAA,KAClB,CACA,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA,IAAA,CAAK,SAAS,CAAC;AAAA,GACnC;AACA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,WAAa,EAAA;AAAA,GACf;AACA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,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 { 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":";;;;;AA8BA,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,EAAA,QAAQ,CAAC,CAAA;AAAA;AAG1B,IAAI,IAAA,kBAAA,CAAmB,IAAQ,IAAA,kBAAA,CAAmB,SAAW,EAAA;AAC3D,MAAO,OAAA;AAAA,QACL;AAAA,UACE,IAAA;AAAA,UACA,mBAAmB,SACjB,CAAA,kBAAA,CAAmB,KAAK,OAAQ,CAAA,KAAK,CACvC,CAAK,IAAA;AAAA;AACP,OACF;AAAA;AAGF,IAAA,IAAI,sBAAwB,EAAA,OAAA,KAAY,KAAS,IAAA,YAAA,CAAa,KAAK,CAAG,EAAA;AAEpE,MAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,KAAK,CAAE,CAAA,OAAA;AAAA,QAAQ,CAAC,CAAC,SAAW,EAAA,WAAW,CAC3D,KAAA,aAAA,CAAc,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAI,CAAA,EAAA,WAAA,EAAa,QAAQ,SAAS;AAAA,OACrE;AAAA;AACF;AAGF,EAAA,OAAO,CAAC,CAAC,IAAM,EAAA,KAAK,CAAC,CAAA;AACvB;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;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;AAAA,KAClB,CACA,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA,IAAA,CAAK,SAAS,CAAC;AAAA,GACnC;AACA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,WAAa,EAAA;AAAA,GACf;AACA,EAAA,uBAAQ,GAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,CAAA;AAC1E;;;;"}