@backstage/plugin-scaffolder-react 2.1.0-next.1 → 2.1.1-next.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 (107) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/alpha.esm.js.map +1 -1
  3. package/dist/api/ref.esm.js.map +1 -1
  4. package/dist/extensions/createScaffolderFieldExtension.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 +132 -67
  9. package/dist/hooks/useEventStream.esm.js.map +1 -1
  10. package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
  11. package/dist/layouts/keys.esm.js.map +1 -1
  12. package/dist/next/api/index.esm.js.map +1 -1
  13. package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
  14. package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
  15. package/dist/next/blueprints/scaffolderTaskOutputsBlueprint.esm.js.map +1 -1
  16. package/dist/next/components/Form/BuiTheme/Form.module.css.esm.js.map +1 -1
  17. package/dist/next/components/Form/BuiTheme/index.esm.js.map +1 -1
  18. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.esm.js.map +1 -1
  19. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.esm.js.map +1 -1
  20. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.esm.js.map +1 -1
  21. package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.esm.js.map +1 -1
  22. package/dist/next/components/Form/BuiTheme/templates/ButtonTemplates.esm.js.map +1 -1
  23. package/dist/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.esm.js.map +1 -1
  24. package/dist/next/components/Form/BuiTheme/templates/ErrorListTemplate.esm.js.map +1 -1
  25. package/dist/next/components/Form/BuiTheme/templates/FieldErrorTemplate.esm.js.map +1 -1
  26. package/dist/next/components/Form/BuiTheme/templates/FieldHelpTemplate.esm.js.map +1 -1
  27. package/dist/next/components/Form/BuiTheme/templates/FieldTemplate.esm.js.map +1 -1
  28. package/dist/next/components/Form/BuiTheme/templates/ObjectFieldTemplate.esm.js.map +1 -1
  29. package/dist/next/components/Form/BuiTheme/templates/TitleFieldTemplate.esm.js.map +1 -1
  30. package/dist/next/components/Form/BuiTheme/templates/UnsupportedFieldTemplate.esm.js.map +1 -1
  31. package/dist/next/components/Form/BuiTheme/templates/WrapIfAdditionalTemplate.esm.js.map +1 -1
  32. package/dist/next/components/Form/BuiTheme/templates/index.esm.js.map +1 -1
  33. package/dist/next/components/Form/BuiTheme/widgets/BaseInputTemplate.esm.js.map +1 -1
  34. package/dist/next/components/Form/BuiTheme/widgets/CheckboxWidget.esm.js.map +1 -1
  35. package/dist/next/components/Form/BuiTheme/widgets/CheckboxesWidget.esm.js.map +1 -1
  36. package/dist/next/components/Form/BuiTheme/widgets/ColorWidget.esm.js.map +1 -1
  37. package/dist/next/components/Form/BuiTheme/widgets/DateInput.esm.js.map +1 -1
  38. package/dist/next/components/Form/BuiTheme/widgets/DateTimeWidget.esm.js.map +1 -1
  39. package/dist/next/components/Form/BuiTheme/widgets/DateWidget.esm.js.map +1 -1
  40. package/dist/next/components/Form/BuiTheme/widgets/EmailWidget.esm.js.map +1 -1
  41. package/dist/next/components/Form/BuiTheme/widgets/FileWidget.esm.js.map +1 -1
  42. package/dist/next/components/Form/BuiTheme/widgets/HiddenWidget.esm.js.map +1 -1
  43. package/dist/next/components/Form/BuiTheme/widgets/PasswordWidget.esm.js.map +1 -1
  44. package/dist/next/components/Form/BuiTheme/widgets/RadioWidget.esm.js.map +1 -1
  45. package/dist/next/components/Form/BuiTheme/widgets/RangeWidget.esm.js.map +1 -1
  46. package/dist/next/components/Form/BuiTheme/widgets/SelectWidget.esm.js.map +1 -1
  47. package/dist/next/components/Form/BuiTheme/widgets/TextWidget.esm.js.map +1 -1
  48. package/dist/next/components/Form/BuiTheme/widgets/TextareaWidget.esm.js.map +1 -1
  49. package/dist/next/components/Form/BuiTheme/widgets/TimeWidget.esm.js.map +1 -1
  50. package/dist/next/components/Form/BuiTheme/widgets/URLWidget.esm.js.map +1 -1
  51. package/dist/next/components/Form/BuiTheme/widgets/index.esm.js.map +1 -1
  52. package/dist/next/components/Form/BuiTheme/widgets/selectOverrides.module.css.esm.js.map +1 -1
  53. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  54. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  55. package/dist/next/components/Form/Form.esm.js.map +1 -1
  56. package/dist/next/components/Form/ScaffolderThemeContext.esm.js.map +1 -1
  57. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  58. package/dist/next/components/ReviewState/ReviewState.esm.js +1 -1
  59. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  60. package/dist/next/components/ReviewState/util.esm.js.map +1 -1
  61. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  62. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  63. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  64. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  65. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
  66. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  67. package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
  68. package/dist/next/components/Stepper/utils.esm.js.map +1 -1
  69. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  70. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  71. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  72. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  73. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  74. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  75. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  76. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  77. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
  78. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
  79. package/dist/next/components/TemplateCard/TemplateCardImpl.esm.js.map +1 -1
  80. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
  81. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
  82. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
  83. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  84. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  85. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  86. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  87. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  88. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  89. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  90. package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
  91. package/dist/next/hooks/useDownloadLogs.esm.js.map +1 -1
  92. package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
  93. package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
  94. package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
  95. package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
  96. package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
  97. package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
  98. package/dist/next/lib/schema.esm.js.map +1 -1
  99. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
  100. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  101. package/dist/packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js.map +1 -1
  102. package/dist/packages/scaffolder-internal/src/wiring/InternalFormField.esm.js.map +1 -1
  103. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  104. package/dist/testUtils/scaffolderApiMock.esm.js.map +1 -1
  105. package/dist/translation.esm.js.map +1 -1
  106. package/dist/utils.esm.js.map +1 -1
  107. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"TaskSteps.esm.js","sources":["../../../../src/next/components/TaskSteps/TaskSteps.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 MuiStepper from '@material-ui/core/Stepper';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepButton from '@material-ui/core/StepButton';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport { StepIconProps } from '@material-ui/core/StepIcon';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { TaskStep } from '@backstage/plugin-scaffolder-common';\nimport { StepIcon } from './StepIcon';\nimport { StepTime } from './StepTime';\nimport { TaskBorder } from './TaskBorder';\nimport { ScaffolderStep } from '@backstage/plugin-scaffolder-react';\n\n/**\n * Props for the TaskSteps component\n *\n * @alpha\n */\nexport interface TaskStepsProps {\n steps: (TaskStep & ScaffolderStep)[];\n activeStep?: number;\n isComplete?: boolean;\n isError?: boolean;\n}\n\n/**\n * The visual stepper of the task event stream\n *\n * @alpha\n */\nexport const TaskSteps = (props: TaskStepsProps) => {\n return (\n <Paper style={{ position: 'relative', overflow: 'hidden' }}>\n <TaskBorder\n isComplete={props.isComplete ?? false}\n isError={props.isError ?? false}\n />\n <Box padding={2}>\n <MuiStepper\n activeStep={props.activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {props.steps.map(step => {\n const isCompleted = step.status === 'completed';\n const isFailed = step.status === 'failed';\n const isActive = step.status === 'processing';\n const isSkipped = step.status === 'skipped';\n const stepIconProps: Partial<StepIconProps & { skipped: boolean }> =\n {\n completed: isCompleted,\n error: isFailed,\n active: isActive,\n skipped: isSkipped,\n };\n\n return (\n <MuiStep key={step.id}>\n <MuiStepButton>\n <MuiStepLabel\n StepIconProps={stepIconProps}\n StepIconComponent={StepIcon}\n data-testid=\"step-label\"\n >\n <Box>{step.name}</Box>\n {!isSkipped && <StepTime step={step} />}\n </MuiStepLabel>\n </MuiStepButton>\n </MuiStep>\n );\n })}\n </MuiStepper>\n </Box>\n </Paper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA6CO,MAAM,SAAA,GAAY,CAAC,KAAA,KAA0B;AAClD,EAAA,uBACE,IAAA,CAAC,SAAM,KAAA,EAAO,EAAE,UAAU,UAAA,EAAY,QAAA,EAAU,UAAS,EACvD,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY,MAAM,UAAA,IAAc,KAAA;AAAA,QAChC,OAAA,EAAS,MAAM,OAAA,IAAW;AAAA;AAAA,KAC5B;AAAA,oBACA,GAAA,CAAC,GAAA,EAAA,EAAI,OAAA,EAAS,CAAA,EACZ,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,YAAY,KAAA,CAAM,UAAA;AAAA,QAClB,gBAAA,EAAgB,IAAA;AAAA,QAChB,OAAA,EAAQ,WAAA;AAAA,QACR,KAAA,EAAO,EAAE,SAAA,EAAW,MAAA,EAAO;AAAA,QAE1B,QAAA,EAAA,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,CAAA,IAAA,KAAQ;AACvB,UAAA,MAAM,WAAA,GAAc,KAAK,MAAA,KAAW,WAAA;AACpC,UAAA,MAAM,QAAA,GAAW,KAAK,MAAA,KAAW,QAAA;AACjC,UAAA,MAAM,QAAA,GAAW,KAAK,MAAA,KAAW,YAAA;AACjC,UAAA,MAAM,SAAA,GAAY,KAAK,MAAA,KAAW,SAAA;AAClC,UAAA,MAAM,aAAA,GACJ;AAAA,YACE,SAAA,EAAW,WAAA;AAAA,YACX,KAAA,EAAO,QAAA;AAAA,YACP,MAAA,EAAQ,QAAA;AAAA,YACR,OAAA,EAAS;AAAA,WACX;AAEF,UAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EACC,QAAA,kBAAA,IAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,aAAA,EAAe,aAAA;AAAA,cACf,iBAAA,EAAmB,QAAA;AAAA,cACnB,aAAA,EAAY,YAAA;AAAA,cAEZ,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,GAAA,EAAA,EAAK,eAAK,IAAA,EAAK,CAAA;AAAA,gBACf,CAAC,SAAA,oBAAa,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAY;AAAA;AAAA;AAAA,WACvC,EACF,CAAA,EAAA,EAVY,IAAA,CAAK,EAWnB,CAAA;AAAA,QAEJ,CAAC;AAAA;AAAA,KACH,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TaskSteps.esm.js","sources":["../../../../src/next/components/TaskSteps/TaskSteps.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 MuiStepper from '@material-ui/core/Stepper';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepButton from '@material-ui/core/StepButton';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport { StepIconProps } from '@material-ui/core/StepIcon';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { TaskStep } from '@backstage/plugin-scaffolder-common';\nimport { StepIcon } from './StepIcon';\nimport { StepTime } from './StepTime';\nimport { TaskBorder } from './TaskBorder';\nimport { ScaffolderStep } from '@backstage/plugin-scaffolder-react';\n\n/**\n * Props for the TaskSteps component\n *\n * @alpha\n */\nexport interface TaskStepsProps {\n steps: (TaskStep & ScaffolderStep)[];\n activeStep?: number;\n isComplete?: boolean;\n isError?: boolean;\n}\n\n/**\n * The visual stepper of the task event stream\n *\n * @alpha\n */\nexport const TaskSteps = (props: TaskStepsProps) => {\n return (\n <Paper style={{ position: 'relative', overflow: 'hidden' }}>\n <TaskBorder\n isComplete={props.isComplete ?? false}\n isError={props.isError ?? false}\n />\n <Box padding={2}>\n <MuiStepper\n activeStep={props.activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {props.steps.map(step => {\n const isCompleted = step.status === 'completed';\n const isFailed = step.status === 'failed';\n const isActive = step.status === 'processing';\n const isSkipped = step.status === 'skipped';\n const stepIconProps: Partial<StepIconProps & { skipped: boolean }> =\n {\n completed: isCompleted,\n error: isFailed,\n active: isActive,\n skipped: isSkipped,\n };\n\n return (\n <MuiStep key={step.id}>\n <MuiStepButton>\n <MuiStepLabel\n StepIconProps={stepIconProps}\n StepIconComponent={StepIcon}\n data-testid=\"step-label\"\n >\n <Box>{step.name}</Box>\n {!isSkipped && <StepTime step={step} />}\n </Mui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,IAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,aAAA,EAAe,aAAA;AAAA,cACf,iBAAA,EAAmB,QAAA;AAAA,cACnB,aAAA,EAAY,YAAA;AAAA,cAEZ,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,GAAA,EAAA,EAAK,eAAK,IAAA,EAAK,CAAA;AAAA,gBACf,CAAC,SAAA,oBAAa,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAY;AAAA;AAAA;AAAA,WACvC,EACF,CAAA,EAAA,EAVY,IAAA,CAAK,EAWnB,CAAA;AAAA,QAEJ,CAAC;AAAA;AAAA,KACH,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CardHeader.esm.js","sources":["../../../../src/next/components/TemplateCard/CardHeader.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 { makeStyles, Theme, useTheme } from '@material-ui/core/styles';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\nimport { TemplateDetailButton } from './TemplateDetailButton.tsx';\n\nconst useStyles = makeStyles<\n Theme,\n {\n cardFontColor: string;\n cardBackgroundImage: string;\n }\n>(() => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n color: ({ cardFontColor }) => cardFontColor,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n detailIcon: {\n color: ({ cardFontColor }) => cardFontColor,\n },\n}));\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardFontColor: themeForType.fontColor,\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <TemplateDetailButton\n className={styles.detailIcon}\n template={props.template}\n />\n <FavoriteEntity\n entity={props.template}\n style={{ padding: 0, marginLeft: 6 }}\n />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAMhB,OAAO;AAAA,EACP,MAAA,EAAQ;AAAA,IACN,eAAA,EAAiB,CAAC,EAAE,mBAAA,EAAoB,KAAM,mBAAA;AAAA,IAC9C,KAAA,EAAO,CAAC,EAAE,aAAA,EAAc,KAAM;AAAA,GAChC;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,MAAA;AAAA,IACT,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,CAAC,EAAE,aAAA,EAAc,KAAM;AAAA;AAElC,CAAA,CAAE,CAAA;AAYK,MAAM,UAAA,GAAa,CAAC,KAAA,KAA2B;AACpD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU;AAAA,MACR,QAAA,EAAU,EAAE,KAAA,EAAO,IAAA,EAAK;AAAA,MACxB,IAAA,EAAM,EAAE,IAAA;AAAK;AACf,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,YAAA,EAAa,GAAI,QAAA,EAAS;AAClC,EAAA,MAAM,YAAA,GAAe,YAAA,CAAa,EAAE,OAAA,EAAS,MAAM,CAAA;AAEnD,EAAA,MAAM,SAAS,SAAA,CAAU;AAAA,IACvB,eAAe,YAAA,CAAa,SAAA;AAAA,IAC5B,qBAAqB,YAAA,CAAa;AAAA,GACnC,CAAA;AAED,EAAA,MAAM,iBAAA,mBACJ,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,eAAA,EACrB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAK,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,yBACV,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,oBAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,UAAA;AAAA,UAClB,UAAU,KAAA,CAAM;AAAA;AAAA,OAClB;AAAA,sBACA,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,QAAQ,KAAA,CAAM,QAAA;AAAA,UACd,KAAA,EAAO,EAAE,OAAA,EAAS,CAAA,EAAG,YAAY,CAAA;AAAE;AAAA;AACrC,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,OAAO,KAAA,IAAS,IAAA;AAAA,MAChB,QAAA,EAAU,iBAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,CAAO,MAAA;AAAO;AAAA,GACjC;AAEJ;;;;"}
1
+ {"version":3,"file":"CardHeader.esm.js","sources":["../../../../src/next/components/TemplateCard/CardHeader.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 { makeStyles, Theme, useTheme } from '@material-ui/core/styles';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\nimport { TemplateDetailButton } from './TemplateDetailButton.tsx';\n\nconst useStyles = makeStyles<\n Theme,\n {\n cardFontColor: string;\n cardBackgroundImage: string;\n }\n>(() => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n color: ({ cardFontColor }) => cardFontColor,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n detailIcon: {\n color: ({ cardFontColor }) => cardFontColor,\n },\n}));\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardFontColor: themeForType.fontColor,\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <TemplateDetailButton\n className={styles.detailIcon}\n template={props.template}\n />\n <FavoriteEntity\n entity={props.template}\n style={{ padding: 0, marginLeft: 6 }}\n />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAMhB,OAAO;AAAA,EACP,MAAA,EAAQ;AAAA,IACN,eAAA,EAAiB,CAAC,EAAE,mBAAA,EAAoB,KAAM,mBAAA;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;AAAA,GAAA,EACF,CAAA;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,OAAO,KAAA,IAAS,IAAA;AAAA,MAChB,QAAA,EAAU,iBAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,CAAO,MAAA;AAAO;AAAA,GACjC;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CardLink.esm.js","sources":["../../../../src/next/components/TemplateCard/CardLink.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 { IconComponent } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\n\nexport interface CardLinkProps {\n icon: IconComponent;\n text: string;\n url: string;\n}\n\nconst useStyles = makeStyles(() => ({\n linkText: {\n display: 'inline-flex',\n alignItems: 'center',\n },\n}));\n\nexport const CardLink = ({ icon: Icon, text, url }: CardLinkProps) => {\n const styles = useStyles();\n\n return (\n <div className={styles.linkText}>\n <Icon fontSize=\"small\" />\n <Link style={{ marginLeft: '8px' }} to={url}>\n {text || url}\n </Link>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA0BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,QAAA,EAAU;AAAA,IACR,OAAA,EAAS,aAAA;AAAA,IACT,UAAA,EAAY;AAAA;AAEhB,CAAA,CAAE,CAAA;AAEK,MAAM,WAAW,CAAC,EAAE,MAAM,IAAA,EAAM,IAAA,EAAM,KAAI,KAAqB;AACpE,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,QAAA,EACrB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,UAAS,OAAA,EAAQ,CAAA;AAAA,oBACvB,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAO,EAAE,UAAA,EAAY,OAAM,EAAG,EAAA,EAAI,GAAA,EACrC,QAAA,EAAA,IAAA,IAAQ,GAAA,EACX;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"CardLink.esm.js","sources":["../../../../src/next/components/TemplateCard/CardLink.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 { IconComponent } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\n\nexport interface CardLinkProps {\n icon: IconComponent;\n text: string;\n url: string;\n}\n\nconst useStyles = makeStyles(() => ({\n linkText: {\n display: 'inline-flex',\n alignItems: 'center',\n },\n}));\n\nexport const CardLink = ({ icon: Icon, text, url }: CardLinkProps) => {\n const styles = useStyles();\n\n return (\n <div className={styles.linkText}>\n <Icon fontSize=\"small\" />\n <Link style={{ marginLeft: '8px' }} to={url}>\n {text || url}\n </Link>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA0BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,QAAA,EAAU;AAAA,IACR,OAAA,EAAS,aAAA;AAAA,IACT,UAAA,EAAY;AAAA;AAEhB,CAAA,CAAE,CAAA;AAEK,MAAM,WAAW,CAAC,EAAE,MAAM,IAAA,EAAM,IAAA,EAAM,KAAI,KAAqB;AACpE,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,QAAA,EACrB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,UAAS,OAAA,EAAQ,CAAA;AAAA,oBACvB,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAO,EAAE,UAAA,EAAY,OAAM,EAAG,EAAA,EAAI,GAAA,EACrC,QAAA,EAAA,IAAA,IAAQ,GAAA,EACX;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCard.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCard.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 { createSwappableComponent } from '@backstage/frontend-plugin-api';\nimport type { TemplateCardComponentProps } from './TemplateCardImpl';\n\nexport type {\n TemplateCardProps,\n TemplateCardComponentProps,\n} from './TemplateCardImpl';\n\n/**\n * The `TemplateCard` component that is rendered in a list for each template.\n * Apps using the new frontend system can replace it by registering a\n * `SwappableComponentBlueprint` that targets `TemplateCard`.\n *\n * @alpha\n */\nexport const TemplateCard =\n createSwappableComponent<TemplateCardComponentProps>({\n id: 'scaffolder.templateCard',\n loader: () => import('./TemplateCardImpl').then(m => m.TemplateCardImpl),\n });\n"],"names":[],"mappings":";;AA+BO,MAAM,eACX,wBAAA,CAAqD;AAAA,EACnD,EAAA,EAAI,yBAAA;AAAA,EACJ,MAAA,EAAQ,MAAM,OAAO,2BAAoB,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,gBAAgB;AACzE,CAAC;;;;"}
1
+ {"version":3,"file":"TemplateCard.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCard.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 { createSwappableComponent } from '@backstage/frontend-plugin-api';\nimport type { TemplateCardComponentProps } from './TemplateCardImpl';\n\nexport type {\n TemplateCardProps,\n TemplateCardComponentProps,\n} from './TemplateCardImpl';\n\n/**\n * The `TemplateCard` component that is rendered in a list for each template.\n * Apps using the new frontend system can replace it by registering a\n * `SwappableComponentBlueprint` that targets `TemplateCard`.\n *\n * @alpha\n */\nexport const TemplateCard =\n createSwappableComponent<TemplateCardComponentProps>({\n id: 'scaffolder.templateCard',\n loader: () => import('./TemplateCardImpl').then(m => m.TemplateCardImpl),\n });\n"],"names":[],"mappings":";;AA+BO,MAAM,eACX,wBAAA,CAAqD;AAAA,EACnD,EAAA,EAAI,yBAAA;AAAA,EACJ,MAAA,EAAQ,MAAM,OAAO,2BAAoB,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,gBAAgB;AACzE,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardActions.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardActions.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 { UserIcon } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { EntityRefLinks } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles<Theme>(theme => ({\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n actionContainer: { padding: '16px', flex: 1, alignItems: 'flex-end' },\n}));\n\n/**\n * The Props for the {@link TemplateCardActions} component\n * @alpha\n */\nexport interface TemplateCardActionsProps {\n ownedByRelations: any;\n canCreateTask: boolean;\n handleChoose: () => void;\n}\nexport const TemplateCardActions = ({\n canCreateTask,\n handleChoose,\n ownedByRelations,\n}: TemplateCardActionsProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n\n return (\n <div className={styles.footer} data-testid=\"template-card-actions--footer\">\n <div\n className={styles.ownedBy}\n data-testid=\"template-card-actions--ownedby\"\n >\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon fontSize=\"small\" />\n <EntityRefLinks\n style={{ marginLeft: '8px' }}\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n hideIcons\n />\n </>\n )}\n </div>\n {canCreateTask ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n color=\"primary\"\n data-testid=\"template-card-actions--create\"\n onClick={handleChoose}\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AAY,KAAA,EAAM;AAAA,cAC3B,UAAA,EAAY,gBAAA;AAAA,cACZ,WAAA,EAAY,OAAA;AAAA,cACZ,SAAA,EAAS;AAAA;AAAA;AACX,SAAA,EACF;AAAA;AAAA,KAEJ;AAAA,IACC,aAAA,mBACC,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,OAAA;AAAA,QACL,OAAA,EAAQ,UAAA;AAAA,QACR,KAAA,EAAM,SAAA;AAAA,QACN,aAAA,EAAY,+BAAA;AAAA,QACZ,OAAA,EAAS,YAAA;AAAA,QAER,YAAE,+BAA+B;AAAA;AAAA,KACpC,GACE;AAAA,GAAA,EACN,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardActions.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardActions.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 { UserIcon } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { EntityRefLinks } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles<Theme>(theme => ({\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n actionContainer: { padding: '16px', flex: 1, alignItems: 'flex-end' },\n}));\n\n/**\n * The Props for the {@link TemplateCardActions} component\n * @alpha\n */\nexport interface TemplateCardActionsProps {\n ownedByRelations: any;\n canCreateTask: boolean;\n handleChoose: () => void;\n}\nexport const TemplateCardActions = ({\n canCreateTask,\n handleChoose,\n ownedByRelations,\n}: TemplateCardActionsProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n\n return (\n <div className={styles.footer} data-testid=\"template-card-actions--footer\">\n <div\n className={styles.ownedBy}\n data-testid=\"template-card-actions--ownedby\"\n >\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon fontSize=\"small\" />\n <EntityRefLinks\n style={{ marginLeft: '8px' }}\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n hideIcons\n />\n </>\n )}\n </div>\n {canCreateTask ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n color=\"primary\"\n data-testid=\"template-card-actions--create\"\n onClick={handleChoose}\n >\n {t('templateCard.chooseButtonText')}\n </Button>\n ) : null}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAkB,CAAA,KAAA,MAAU;AAAA,EAC5C,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,MAAA;AAAA,IACT,cAAA,EAAgB,eAAA;AAAA,IAChB,IAAA,EAAM,CAAA;AAAA,IACN,UAAA,EAAY;AAAA,GACd;AAAA,EACA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,IAAA,EAAM,CAAA;AAAA,IACN,KAAA,EAAO,MAAM,OAAA,CAAQ;AAAA,GACvB;AAAA,EACA,iBAAiB,EAAE,OAAA,EAAS,QAAQ,IAAA,EAAM,CAAA,EAAG,YAAY,UAAA;AAC3D,CAAA,CAAE,CAAA;AAWK,MAAM,sBAAsB,CAAC;AAAA,EAClC,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,KAAgC;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,MAAA,EAAQ,eAAY,+BAAA,EACzC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAA,CAAO,OAAA;AAAA,QAClB,aAAA,EAAY,gCAAA;AAAA,QAEX,QAAA,EAAA,gBAAA,CAAiB,MAAA,GAAS,CAAA,oBACzB,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,QAAA,EAAA,EAAS,UAAS,OAAA,EAAQ,CAAA;AAAA,0BAC3B,GAAA;AAAA,YAAC,cAAA;AAAA,YAAA;AAAA,cACC,KAAA,EAAO,EAAE,UAAA,EAAY,KAAA,EAAM;AAAA,cAC3B,UAAA,EAAY,gBAAA;AAAA,cACZ,WAAA,EAAY,OAAA;AAAA,cACZ,SAAA,EAAS;AAAA;AAAA;AACX,SAAA,EACF;AAAA;AAAA,KAEJ;AAAA,IACC,aAAA,mBACC,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,OAAA;AAAA,QACL,OAAA,EAAQ,UAAA;AAAA,QACR,KAAA,EAAM,SAAA;AAAA,QACN,aAAA,EAAY,+BAAA;AAAA,QACZ,OAAA,EAAS,YAAA;AAAA,QAER,YAAE,+BAA+B;AAAA;AAAA,KACpC,GACE;AAAA,GAAA,EACN,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardContent.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardContent.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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(() => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n}));\n\n/**\n * The Props for the {@link TemplateCardContent} component\n * @alpha\n */\nexport interface TemplateCardContentProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardContent = ({ template }: TemplateCardContentProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n return (\n <Grid item xs={12} data-testid=\"template-card-content-grid\">\n <Box className={styles.box} data-testid=\"template-card-content-container\">\n <MarkdownContent\n className={styles.markdown}\n content={\n template.metadata.description ?? t('templateCard.noDescription')\n }\n />\n </Box>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,GAAA,EAAK;AAAA,IACH,QAAA,EAAU,QAAA;AAAA,IACV,YAAA,EAAc,UAAA;AAAA,IACd,OAAA,EAAS,aAAA;AAAA,IACT,oBAAA,EAAsB,EAAA;AAAA,IACtB,oBAAA,EAAsB;AAAA,GACxB;AAAA,EACA,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ;AAAA;AACV;AAEJ,CAAA,CAAE,CAAA;AASK,MAAM,mBAAA,GAAsB,CAAC,EAAE,QAAA,EAAS,KAAgC;AAC7E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EAAI,aAAA,EAAY,4BAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,GAAA,EAAK,eAAY,iCAAA,EACtC,QAAA,kBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,MAAA,CAAO,QAAA;AAAA,MAClB,OAAA,EACE,QAAA,CAAS,QAAA,CAAS,WAAA,IAAe,EAAE,4BAA4B;AAAA;AAAA,KAGrE,CAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardContent.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardContent.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 { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(() => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n}));\n\n/**\n * The Props for the {@link TemplateCardContent} component\n * @alpha\n */\nexport interface TemplateCardContentProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardContent = ({ template }: TemplateCardContentProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const styles = useStyles();\n return (\n <Grid item xs={12} data-testid=\"template-card-content-grid\">\n <Box className={styles.box} data-testid=\"template-card-content-container\">\n <MarkdownContent\n className={styles.markdown}\n content={\n template.metadata.description ?? t('templateCard.noDescription')\n }\n />\n </Box>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,GAAA,EAAK;AAAA,IACH,QAAA,EAAU,QAAA;AAAA,IACV,YAAA,EAAc,UAAA;AAAA,IACd,OAAA,EAAS,aAAA;AAAA,IACT,oBAAA,EAAsB,EAAA;AAAA,IACtB,oBAAA,EAAsB;AAAA,GACxB;AAAA,EACA,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ;AAAA;AACV;AAEJ,CAAA,CAAE,CAAA;AASK,MAAM,mBAAA,GAAsB,CAAC,EAAE,QAAA,EAAS,KAAgC;AAC7E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EAAI,aAAA,EAAY,4BAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,GAAA,EAAK,eAAY,iCAAA,EACtC,QAAA,kBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,MAAA,CAAO,QAAA;AAAA,MAClB,OAAA,EACE,QAAA,CAAS,QAAA,CAAS,WAAA,IAAe,EAAE,4BAA4B;AAAA;AAAA,KAGrE,CAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardImpl.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardImpl.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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { IconComponent, useAnalytics } from '@backstage/core-plugin-api';\nimport { getEntityRelations } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { useCallback } from 'react';\nimport { CardHeader } from './CardHeader';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { taskCreatePermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport { TemplateCardContent } from './TemplateCardContent';\nimport { TemplateCardTags } from './TemplateCardTags';\nimport { TemplateCardLinks } from './TemplateCardLinks';\nimport { TemplateCardActions } from './TemplateCardActions';\n\nconst useStyles = makeStyles<Theme>(() => ({\n actionContainer: { padding: '16px', flex: 1, alignItems: 'flex-end' },\n}));\n\n/**\n * The legacy Props for the `CardComponent` slot in {@link TemplateGroupsProps}.\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n onSelected?: (template: TemplateEntityV1beta3) => void;\n}\n\n/**\n * The Props for components used as the swappable {@link TemplateCard}. The\n * surrounding list takes care of binding the template to `onSelected`, so\n * implementations only need to invoke it without arguments.\n * @alpha\n */\nexport interface TemplateCardComponentProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n onSelected?: () => void;\n}\n\n/**\n * Default implementation of the `TemplateCard`. The exported `TemplateCard`\n * is a swappable wrapper around this component.\n */\nexport const TemplateCardImpl = (props: TemplateCardComponentProps) => {\n const { additionalLinks, onSelected, template } = props;\n const styles = useStyles();\n const analytics = useAnalytics();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const hasTags = !!template.metadata.tags?.length;\n const hasLinks =\n !!additionalLinks?.length || !!template.metadata.links?.length;\n const displayDefaultDivider = !hasTags && !hasLinks;\n\n const { allowed: canCreateTask } = usePermission({\n permission: taskCreatePermission,\n });\n const handleChoose = useCallback(() => {\n analytics.captureEvent('click', 'Template has been opened');\n onSelected?.();\n }, [analytics, onSelected]);\n\n return (\n <Card>\n <CardHeader template={template} data-testid=\"template-card-header\" />\n <CardContent>\n <Grid container spacing={2} data-testid=\"template-card-content\">\n <TemplateCardContent template={template} />\n {displayDefaultDivider && (\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator\" />\n </Grid>\n )}\n {hasTags && <TemplateCardTags template={template} />}\n {hasLinks && (\n <TemplateCardLinks\n template={template}\n additionalLinks={additionalLinks}\n />\n )}\n </Grid>\n </CardContent>\n <CardActions\n className={styles.actionContainer}\n data-testid=\"template-card-actions\"\n >\n <TemplateCardActions\n canCreateTask={canCreateTask}\n handleChoose={handle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AAA,IAAA,CAAC,IAAA,EAAA,EAAK,WAAS,IAAA,EAAC,OAAA,EAAS,CAAA,EAAG,aAAA,EAAY,uBAAA,EACtC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,uBAAoB,QAAA,EAAoB,CAAA;AAAA,MACxC,qBAAA,oBACC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,yBAAA,EAA0B,CAAA,EACjD,CAAA;AAAA,MAED,OAAA,oBAAW,GAAA,CAAC,gBAAA,EAAA,EAAiB,QAAA,EAAoB,CAAA;AAAA,MACjD,QAAA,oBACC,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,QAAA;AAAA,UACA;AAAA;AAAA;AACF,KAAA,EAEJ,CAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAA,CAAO,eAAA;AAAA,QAClB,aAAA,EAAY,uBAAA;AAAA,QAEZ,QAAA,kBAAA,GAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,aAAA;AAAA,YACA,YAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardImpl.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardImpl.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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { IconComponent, useAnalytics } from '@backstage/core-plugin-api';\nimport { getEntityRelations } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { useCallback } from 'react';\nimport { CardHeader } from './CardHeader';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { taskCreatePermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport { TemplateCardContent } from './TemplateCardContent';\nimport { TemplateCardTags } from './TemplateCardTags';\nimport { TemplateCardLinks } from './TemplateCardLinks';\nimport { TemplateCardActions } from './TemplateCardActions';\n\nconst useStyles = makeStyles<Theme>(() => ({\n actionContainer: { padding: '16px', flex: 1, alignItems: 'flex-end' },\n}));\n\n/**\n * The legacy Props for the `CardComponent` slot in {@link TemplateGroupsProps}.\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n onSelected?: (template: TemplateEntityV1beta3) => void;\n}\n\n/**\n * The Props for components used as the swappable {@link TemplateCard}. The\n * surrounding list takes care of binding the template to `onSelected`, so\n * implementations only need to invoke it without arguments.\n * @alpha\n */\nexport interface TemplateCardComponentProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n onSelected?: () => void;\n}\n\n/**\n * Default implementation of the `TemplateCard`. The exported `TemplateCard`\n * is a swappable wrapper around this component.\n */\nexport const TemplateCardImpl = (props: TemplateCardComponentProps) => {\n const { additionalLinks, onSelected, template } = props;\n const styles = useStyles();\n const analytics = useAnalytics();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const hasTags = !!template.metadata.tags?.length;\n const hasLinks =\n !!additionalLinks?.length || !!template.metadata.links?.length;\n const displayDefaultDivider = !hasTags && !hasLinks;\n\n const { allowed: canCreateTask } = usePermission({\n permission: taskCreatePermission,\n });\n const handleChoose = useCallback(() => {\n analytics.captureEvent('click', 'Template has been opened');\n onSelected?.();\n }, [analytics, onSelected]);\n\n return (\n <Card>\n <CardHeader template={template} data-testid=\"template-card-header\" />\n <CardContent>\n <Grid container spacing={2} data-testid=\"template-card-content\">\n <TemplateCardContent template={template} />\n {displayDefaultDivider && (\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator\" />\n </Grid>\n )}\n {hasTags && <TemplateCardTags template={template} />}\n {hasLinks && (\n <TemplateCardLinks\n template={template}\n additionalLinks={additionalLinks}\n />\n )}\n </Grid>\n </CardContent>\n <CardActions\n className={styles.actionContainer}\n data-testid=\"template-card-actions\"\n >\n <TemplateCardActions\n canCreateTask={canCreateTask}\n handleChoose={handleChoose}\n ownedByRelations={ownedByRelations}\n />\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,WAAkB,OAAO;AAAA,EACzC,iBAAiB,EAAE,OAAA,EAAS,QAAQ,IAAA,EAAM,CAAA,EAAG,YAAY,UAAA;AAC3D,CAAA,CAAE,CAAA;AAoCK,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAAsC;AACrE,EAAA,MAAM,EAAE,eAAA,EAAiB,UAAA,EAAY,QAAA,EAAS,GAAI,KAAA;AAClD,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,YAAY,YAAA,EAAa;AAC/B,EAAA,MAAM,gBAAA,GAAmB,kBAAA,CAAmB,QAAA,EAAU,iBAAiB,CAAA;AACvE,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,QAAA,CAAS,SAAS,IAAA,EAAM,MAAA;AAC1C,EAAA,MAAM,QAAA,GACJ,CAAC,CAAC,e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WAAW,MAAA,CAAO,eAAA;AAAA,QAClB,aAAA,EAAY,uBAAA;AAAA,QAEZ,QAAA,kBAAA,GAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,aAAA;AAAA,YACA,YAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardLinks.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardLinks.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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<Theme>({});\n\n/**\n * The Props for the {@link TemplateCardLinks} component\n * @alpha\n */\nexport interface TemplateCardLinksProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\nexport const TemplateCardLinks = ({\n template,\n additionalLinks,\n}: TemplateCardLinksProps) => {\n const styles = useStyles();\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n return (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--links\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-links\">\n {additionalLinks?.map(({ icon, text, url }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--item\"\n >\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--metalink\"\n >\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,UAAA,CAAkB,EAAE,CAAA;AAc/B,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,CAAC,GAAA,KACpB,GAAA,GAAM,IAAI,aAAA,CAAc,GAAG,KAAK,YAAA,GAAe,YAAA;AACjD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,gCAAA,EAAiC,CAAA,EACxD,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,CAAA,EAAG,eAAY,qBAAA,EACrC,QAAA,EAAA;AAAA,MAAA,eAAA,EAAiB,IAAI,CAAC,EAAE,MAAM,IAAA,EAAM,GAAA,IAAO,KAAA,qBAC1C,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,QAAA;AAAA,UAClB,IAAA,EAAI,IAAA;AAAA,UACJ,EAAA,EAAI,CAAA;AAAA,UAEJ,aAAA,EAAY,2BAAA;AAAA,UAEZ,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAY,IAAA,EAAY,GAAA,EAAU;AAAA,SAAA;AAAA,QAHvC;AAAA,OAKR,CAAA;AAAA,MACA,QAAA,CAAS,QAAA,CAAS,KAAA,EAAO,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,IAAA,EAAM,KAAA,EAAM,EAAG,KAAA,qBACnD,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,QAAA;AAAA,UAClB,IAAA,EAAI,IAAA;AAAA,UACJ,EAAA,EAAI,CAAA;AAAA,UAEJ,aAAA,EAAY,+BAAA;AAAA,UAEZ,QAAA,kBAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAM,aAAa,IAAI,CAAA;AAAA,cACvB,MAAM,KAAA,IAAS,GAAA;AAAA,cACf;AAAA;AAAA;AACF,SAAA;AAAA,QAPK;AAAA,OASR;AAAA,KAAA,EACH,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCardLinks.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardLinks.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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<Theme>({});\n\n/**\n * The Props for the {@link TemplateCardLinks} component\n * @alpha\n */\nexport interface TemplateCardLinksProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\nexport const TemplateCardLinks = ({\n template,\n additionalLinks,\n}: TemplateCardLinksProps) => {\n const styles = useStyles();\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n return (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--links\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-links\">\n {additionalLinks?.map(({ icon, text, url }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--item\"\n >\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }, index) => (\n <Grid\n className={styles.linkText}\n item\n xs={6}\n key={index}\n data-testid=\"template-card-links--metalink\"\n >\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,UAAA,CAAkB,EAAE,CAAA;AAc/B,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,CAAC,GAAA,KACpB,GAAA,GAAM,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cACC,IAAA,EAAM,aAAa,IAAI,CAAA;AAAA,cACvB,MAAM,KAAA,IAAS,GAAA;AAAA,cACf;AAAA;AAAA;AACF,SAAA;AAAA,QAPK;AAAA,OASR;AAAA,KAAA,EACH,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCardTags.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardTags.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 type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\n\n/**\n * The Props for the {@link TemplateCardTags} component\n * @alpha\n */\nexport interface TemplateCardTagsProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardTags = ({ template }: TemplateCardTagsProps) => (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--tags\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-tags\">\n {template.metadata.tags?.map(tag => (\n <Grid\n key={`grid-${tag}`}\n item\n data-testid={`template-card-tag-item-${tag}`}\n >\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n data-testid={`template-card-tag-chip-${tag}`}\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,gBAAA,GAAmB,CAAC,EAAE,QAAA,uBACjC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,+BAAA,EAAgC,CAAA,EACvD,CAAA;AAAA,sBACC,IAAA,EAAA,EAAK,IAAA,EAAI,MAAC,EAAA,EAAI,EAAA,EACb,8BAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,GAAG,aAAA,EAAY,oBAAA,EACrC,mBAAS,QAAA,CAAS,IAAA,EAAM,IAAI,CAAA,GAAA,qBAC3B,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEC,IAAA,EAAI,IAAA;AAAA,MACJ,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,MAE1C,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAE;AAAA,UACnB,IAAA,EAAK,OAAA;AAAA,UACL,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,UAC1C,KAAA,EAAO;AAAA,SAAA;AAAA,QACF;AAAA;AACP,KAAA;AAAA,IAVK,QAAQ,GAAG,CAAA;AAAA,GAYnB,GACH,CAAA,EACF;AAAA,CAAA,EACF;;;;"}
1
+ {"version":3,"file":"TemplateCardTags.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateCardTags.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 type { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Grid from '@material-ui/core/Grid';\n\n/**\n * The Props for the {@link TemplateCardTags} component\n * @alpha\n */\nexport interface TemplateCardTagsProps {\n template: TemplateEntityV1beta3;\n}\nexport const TemplateCardTags = ({ template }: TemplateCardTagsProps) => (\n <>\n <Grid item xs={12}>\n <Divider data-testid=\"template-card-separator--tags\" />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2} data-testid=\"template-card-tags\">\n {template.metadata.tags?.map(tag => (\n <Grid\n key={`grid-${tag}`}\n item\n data-testid={`template-card-tag-item-${tag}`}\n >\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n data-testid={`template-card-tag-chip-${tag}`}\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,gBAAA,GAAmB,CAAC,EAAE,QAAA,uBACjC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,aAAA,EAAY,+BAAA,EAAgC,CAAA,EACvD,CAAA;AAAA,sBACC,IAAA,EAAA,EAAK,IAAA,EAAI,MAAC,EAAA,EAAI,EAAA,EACb,8BAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,GAAG,aAAA,EAAY,oBAAA,EACrC,mBAAS,QAAA,CAAS,IAAA,EAAM,IAAI,CAAA,GAAA,qBAC3B,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEC,IAAA,EAAI,IAAA;AAAA,MACJ,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,MAE1C,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAE;AAAA,UACnB,IAAA,EAAK,OAAA;AAAA,UACL,aAAA,EAAa,0BAA0B,GAAG,CAAA,CAAA;AAAA,UAC1C,KAAA,EAAO;AAAA,SAAA;AAAA,QACF;AAAA;AACP,KAAA;AAAA,IAVK,QAAQ,GAAG,CAAA;AAAA,GAYnB,GACH,CAAA,EACF;AAAA,CAAA,EACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateDetailButton.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateDetailButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { Link } from '@backstage/core-components';\nimport {\n entityRouteParams,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nexport interface TemplateDetailButtonProps {\n template: Entity;\n className?: string;\n}\n\nexport const TemplateDetailButton = ({\n template,\n className,\n}: TemplateDetailButtonProps) => {\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const entityRef = stringifyEntityRef(template);\n\n const app = useApp();\n const TemplateIcon = app.getSystemIcon('kind:template') || DescriptionIcon;\n\n return (\n <Tooltip id={`tooltip-${entityRef}`} title={t('cardHeader.detailBtnTitle')}>\n <IconButton\n aria-label={t('cardHeader.detailBtnTitle')}\n id={`viewDetail-${entityRef}`}\n style={{ padding: 0 }}\n >\n <Typography component=\"span\">\n <Link\n to={catalogEntityRoute(entityRouteParams(template))}\n style={{ display: 'flex', alignItems: 'center' }}\n >\n <TemplateIcon className={className} />\n </Link>\n </Typography>\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,uBAAuB,CAAC;AAAA,EACnC,QAAA;AAAA,EACA;AACF,CAAA,KAAiC;AAC/B,EAAA,MAAM,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAA,GAAY,mBAAmB,QAAQ,CAAA;AAE7C,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,GAAA,CAAI,aAAA,CAAc,eAAe,CAAA,IAAK,eAAA;AAE3D,EAAA,uBACE,GAAA,CAAC,WAAQ,EAAA,EAAI,CAAA,QAAA,EAAW,SAAS,CAAA,CAAA,EAAI,KAAA,EAAO,CAAA,CAAE,2BAA2B,CAAA,EACvE,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,EAAE,2BAA2B,CAAA;AAAA,MACzC,EAAA,EAAI,cAAc,SAAS,CAAA,CAAA;AAAA,MAC3B,KAAA,EAAO,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,MAEpB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAU,MAAA,EACpB,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAA,EAAI,kBAAA,CAAmB,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,UAClD,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAQ,YAAY,QAAA,EAAS;AAAA,UAE/C,QAAA,kBAAA,GAAA,CAAC,gBAAa,SAAA,EAAsB;AAAA;AAAA,OACtC,EACF;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateDetailButton.esm.js","sources":["../../../../src/next/components/TemplateCard/TemplateDetailButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { Link } from '@backstage/core-components';\nimport {\n entityRouteParams,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nexport interface TemplateDetailButtonProps {\n template: Entity;\n className?: string;\n}\n\nexport const TemplateDetailButton = ({\n template,\n className,\n}: TemplateDetailButtonProps) => {\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const entityRef = stringifyEntityRef(template);\n\n const app = useApp();\n const TemplateIcon = app.getSystemIcon('kind:template') || DescriptionIcon;\n\n return (\n <Tooltip id={`tooltip-${entityRef}`} title={t('cardHeader.detailBtnTitle')}>\n <IconButton\n aria-label={t('cardHeader.detailBtnTitle')}\n id={`viewDetail-${entityRef}`}\n style={{ padding: 0 }}\n >\n <Typography component=\"span\">\n <Link\n to={catalogEntityRoute(entityRouteParams(template))}\n style={{ display: 'flex', alignItems: 'center' }}\n >\n <TemplateIcon className={className} />\n </Link>\n </Typography>\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,uBAAuB,CAAC;AAAA,EACnC,QAAA;AAAA,EACA;AACF,CAAA,KAAiC;AAC/B,EAAA,MAAM,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAA,GAAY,mBAAmB,QAAQ,CAAA;AAE7C,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,YAAA,GAAe,GAAA,CAAI,aAAA,CAAc,eAAe,CAAA,IAAK,eAAA;AAE3D,EAAA,uBACE,GAAA,CAAC,WAAQ,EAAA,EAAI,CAAA,QAAA,EAAW,SAAS,CAAA,CAAA,EAAI,KAAA,EAAO,CAAA,CAAE,2BAA2B,CAAA,EACvE,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,EAAE,2BAA2B,CAAA;AAAA,MACzC,EAAA,EAAI,cAAc,SAAS,CAAA,CAAA;AAAA,MAC3B,KAAA,EAAO,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,MAEpB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAU,MAAA,EACpB,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAA,EAAI,kBAAA,CAAmB,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,UAClD,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAQ,YAAY,QAAA,EAAS;AAAA,UAE/C,QAAA,kBAAA,GAAA,CAAC,gBAAa,SAAA,EAAsB;AAAA;AAAA,OACtC,EACF;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateCategoryPicker.esm.js","sources":["../../../../src/next/components/TemplateCategoryPicker/TemplateCategoryPicker.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 { Progress } from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport capitalize from 'lodash/capitalize';\nimport { ReactNode } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @alpha */\nexport type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n },\n { name: 'ScaffolderReactTemplateCategoryPicker' },\n);\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n * @alpha\n */\nexport const TemplateCategoryPicker = () => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography\n className={classes.label}\n variant=\"button\"\n component=\"label\"\n htmlFor=\"categories-picker\"\n >\n {t('templateCategoryPicker.title')}\n </Typography>\n <Autocomplete<string, true>\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n id=\"categories-picker\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM,IAAA,mBAAO,GAAA,CAAC,wBAAA,EAAA,EAAyB,QAAA,EAAS,OAAA,EAAQ,CAAA;AACxD,MAAM,WAAA,mBAAc,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAS,OAAA,EAAQ,CAAA;AAKnD,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,MAAM,EAAC;AAAA,IACP,OAAO;AAAC,GACV;AAAA,EACA,EAAE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AA,QACP,QAAA,EAAU,CAAC,CAAA,EAAW,KAAA,KAAoB,iBAAiB,KAAK,CAAA;AAAA,QAChE,YAAA,EAAc,CAAC,MAAA,EAAQ,EAAE,UAAS,qBAChC,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,OAAA,kBACE,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA;AAAA,gBACA,WAAA;AAAA,gBACA,OAAA,EAAS;AAAA;AAAA,aACX;AAAA,YAEF,KAAA,EAAO,WAAW,MAAM;AAAA;AAAA,SAC1B;AAAA,QAEF,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,sBAAY,cAAA,EAAA,EAAe,CAAA;AAAA,QAC3B,aAAa,CAAA,MAAA,qBAAU,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAA,EAAW;AAAA;AAAA;AACnE,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateCategoryPicker.esm.js","sources":["../../../../src/next/components/TemplateCategoryPicker/TemplateCategoryPicker.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 { Progress } from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport capitalize from 'lodash/capitalize';\nimport { ReactNode } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @alpha */\nexport type ScaffolderReactTemplateCategoryPickerClassKey = 'root' | 'label';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n },\n { name: 'ScaffolderReactTemplateCategoryPicker' },\n);\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n * @alpha\n */\nexport const TemplateCategoryPicker = () => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography\n className={classes.label}\n variant=\"button\"\n component=\"label\"\n htmlFor=\"categories-picker\"\n >\n {t('templateCategoryPicker.title')}\n </Typography>\n <Autocomplete<string, true>\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n id=\"categories-picker\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}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,KAAA;AAAA,QACnB,OAAA,EAAQ,QAAA;AAAA,QACR,SAAA,EAAU,OAAA;AAAA,QACV,OAAA,EAAQ,mBAAA;AAAA,QAEP,YAAE,8BAA8B;AAAA;AAAA,KACnC;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,iBAAiB,CAAA,WAAA,qBACf,GAAA,CAAC,SAAK,GAAG,WAAA,EAAc,sBAAY,QAAA,EAAsB,CAAA;AAAA,QAE3D,QAAA,EAAQ,IAAA;AAAA,QACR,EAAA,EAAG,mBAAA;AAAA,QACH,OAAA,EAAS,cAAA;AAAA,QACT,KAAA,EAAO,aAAA;AAAA,QACP,QAAA,EAAU,CAAC,CAAA,EAAW,KAAA,KAAoB,iBAAiB,KAAK,CAAA;AAAA,QAChE,YAAA,EAAc,CAAC,MAAA,EAAQ,EAAE,UAAS,qBAChC,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,OAAA,kBACE,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA;AAAA,gBACA,WAAA;AAAA,gBACA,OAAA,EAAS;AAAA;AAAA,aACX;AAAA,YAEF,KAAA,EAAO,WAAW,MAAM;AAAA;AAAA,SAC1B;AAAA,QAEF,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,sBAAY,cAAA,EAAA,EAAe,CAAA;AAAA,QAC3B,aAAa,CAAA,MAAA,qBAAU,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAA,EAAW;AAAA;AAAA;AACnE,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateGroup.esm.js","sources":["../../../../src/next/components/TemplateGroup/TemplateGroup.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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { ReactNode, ComponentType } from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n} from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { AnalyticsContext, IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: ReactNode;\n components?: {\n CardComponent?: ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <AnalyticsContext\n attributes={{\n entityRef: stringifyEntityRef(template),\n }}\n key={stringifyEntityRef(template)}\n >\n {CardComponent ? (\n <CardComponent\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n ) : (\n <TemplateCard\n additionalLinks={additionalLinks}\n template={template}\n onSelected={() => onSelected(template)}\n />\n )}\n </AnalyticsContext>\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkDO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA8B;AAC1D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA,EAAY,EAAE,aAAA,EAAc,GAAI,EAAC;AAAA,IACjC;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,iBACJ,OAAO,KAAA,KAAU,2BAAW,GAAA,CAAC,aAAA,EAAA,EAAc,OAAc,CAAA,GAAK,KAAA;AAEhE,EAAA,IAAI,SAAA,CAAU,WAAW,CAAA,EAAG;AAC1B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,4BACG,OAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,cAAA;AAAA,oBACD,GAAA,CAAC,gBACE,QAAA,EAAA,SAAA,CAAU,GAAA,CAAI,CAAC,EAAE,QAAA,EAAU,iBAAgB,qBAC1C,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY;AAAA,UACV,SAAA,EAAW,mBAAmB,QAAQ;AAAA,SACxC;AAAA,QAGC,QAAA,EAAA,aAAA,mBACC,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA;AAAA;AAAA,SACF,mBAEA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA,UAAA,EAAY,MAAM,UAAA,CAAW,QAAQ;AAAA;AAAA;AACvC,OAAA;AAAA,MAbG,mBAAmB,QAAQ;AAAA,KAgBnC,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateGroup.esm.js","sources":["../../../../src/next/components/TemplateGroup/TemplateGroup.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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { ReactNode, ComponentType } from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n} from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { AnalyticsContext, IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: ReactNode;\n components?: {\n CardComponent?: ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <AnalyticsContext\n attributes={{\n entityRef: stringifyEntityRef(template),\n }}\n key={stringifyEntityRef(template)}\n >\n {CardComponent ? (\n <CardComponent\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n ) : (\n <TemplateCard\n additionalLinks={additionalLinks}\n template={template}\n onSelected={() => onSelected(template)}\n />\n )}\n </AnalyticsContext>\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkDO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA8B;AAC1D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA,EAAY,EAAE,aAAA,EAAc,GAAI,EAAC;AAAA,IACjC;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,iBACJ,OAAO,KAAA,KAAU,2BAAW,GAAA,CAAC,aAAA,EAAA,EAAc,OAAc,CAAA,GAAK,KAAA;AAEhE,EAAA,IAAI,SAAA,CAAU,WAAW,CAAA,EAAG;AAC1B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,4BACG,OAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,cAAA;AAAA,oBACD,GAAA,CAAC,gBACE,QAAA,EAAA,SAAA,CAAU,GAAA,CAAI,CAAC,EAAE,QAAA,EAAU,iBAAgB,qBAC1C,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY;AAAA,UACV,SAAA,EAAW,mBAAmB,QAAQ;AAAA,SACxC;AAAA,QAGC,QAAA,EAAA,aAAA,mBACC,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA;AAAA;AAAA,SACF,mBAEA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,eAAA;AAAA,YACA,QAAA;AAAA,YACA,UAAA,EAAY,MAAM,UAAA,CAAW,QAAQ;AAAA;AAAA;AACvC,OAAA;AAAA,MAbG,mBAAmB,QAAQ;AAAA,KAgBnC,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateGroups.esm.js","sources":["../../../../src/next/components/TemplateGroups/TemplateGroups.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 { Link, Progress } from '@backstage/core-components';\nimport { errorApiRef, IconComponent, useApi } from '@backstage/core-plugin-api';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport {\n isTemplateEntityV1beta3,\n TemplateEntityV1beta3,\n} from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { TemplateGroup } from '../TemplateGroup/TemplateGroup';\n\n/**\n * @alpha\n */\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n TemplateCardComponent?: ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n onTemplateSelected?: (template: TemplateEntityV1beta3) => void;\n additionalLinksForEntity?: (template: TemplateEntityV1beta3) => {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\n\n/**\n * @alpha\n */\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, templateFilter, TemplateCardComponent, onTemplateSelected } =\n props;\n const errorApi = useApi(errorApiRef);\n const onSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n onTemplateSelected?.(template);\n },\n [onTemplateSelected],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => {\n const templates = entities\n .filter(isTemplateEntityV1beta3)\n .filter(e => (templateFilter ? templateFilter(e) : true))\n .filter(filter)\n .map(template => {\n const additionalLinks =\n props.additionalLinksForEntity?.(template) ?? [];\n\n return {\n template,\n additionalLinks,\n };\n });\n\n return (\n <TemplateGroup\n key={index}\n templates={templates}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n onSelected={onSelected}\n />\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgDO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,QAAA,KAAa,aAAA,EAAc;AACnD,EAAA,MAAM,EAAE,MAAA,EAAQ,cAAA,EAAgB,qBAAA,EAAuB,oBAAmB,GACxE,KAAA;AACF,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAA,GAAa,WAAA;AAAA,IACjB,CAAC,QAAA,KAAoC;AACnC,MAAA,kBAAA,GAAqB,QAAQ,CAAA;AAAA,IAC/B,CAAA;AAAA,IACA,CAAC,kBAAkB;AAAA,GACrB;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA,IACrB;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,QAAQ,CAAC,CAAA;AAEpB,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,QAAA,IAAY,CAAC,QAAA,CAAS,MAAA,EAAQ;AACjC,IAAA,uBACE,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,6DAAA;AAAA,MACkC,GAAA;AAAA,sBAC5D,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,wEAAA,EAAyE,QAAA,EAAA,kBAAA,EAElF,CAAA;AAAA,MAAO;AAAA,KAAA,EAET,CAAA;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA,CAAA,QAAA,EAAA,EACG,iBAAO,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,MAAA,IAAU,KAAA,KAAU;AACxC,IAAA,MAAM,YAAY,QAAA,CACf,MAAA,CAAO,uBAAuB,CAAA,CAC9B,OAAO,CAAA,CAAA,KAAM,cAAA,GAAiB,cAAA,CAAe,CAAC,IAAI,IAAK,CAAA,CACvD,OAAO,MAAM,CAAA,CACb,IAAI,CAAA,QAAA,KAAY;AACf,MAAA,MAAM,eAAA,GACJ,KAAA,CAAM,wBAAA,GAA2B,QAAQ,KAAK,EAAC;AAEjD,MAAA,OAAO;AAAA,QACL,QAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAEH,IAAA,uBACE,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA,EAAY,EAAE,aAAA,EAAe,qBAAA,EAAsB;AAAA,QACnD;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ,CAAC,CAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateGroups.esm.js","sources":["../../../../src/next/components/TemplateGroups/TemplateGroups.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 { Link, Progress } from '@backstage/core-components';\nimport { errorApiRef, IconComponent, useApi } from '@backstage/core-plugin-api';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport {\n isTemplateEntityV1beta3,\n TemplateEntityV1beta3,\n} from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { TemplateGroup } from '../TemplateGroup/TemplateGroup';\n\n/**\n * @alpha\n */\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n TemplateCardComponent?: ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n onTemplateSelected?: (template: TemplateEntityV1beta3) => void;\n additionalLinksForEntity?: (template: TemplateEntityV1beta3) => {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n}\n\n/**\n * @alpha\n */\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, templateFilter, TemplateCardComponent, onTemplateSelected } =\n props;\n const errorApi = useApi(errorApiRef);\n const onSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n onTemplateSelected?.(template);\n },\n [onTemplateSelected],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => {\n const templates = entities\n .filter(isTemplateEntityV1beta3)\n .filter(e => (templateFilter ? templateFilter(e) : true))\n .filter(filter)\n .map(template => {\n const additionalLinks =\n props.additionalLinksForEntity?.(template) ?? [];\n\n return {\n template,\n additionalLinks,\n };\n });\n\n return (\n <TemplateGroup\n key={index}\n templates={templates}\n title={title}\n components={{ CardComponent: Tem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E,KAAA,EAAO,MAAA,IAAU,KAAA,KAAU;AACxC,IAAA,MAAM,YAAY,QAAA,CACf,MAAA,CAAO,uBAAuB,CAAA,CAC9B,OAAO,CAAA,CAAA,KAAM,cAAA,GAAiB,cAAA,CAAe,CAAC,IAAI,IAAK,CAAA,CACvD,OAAO,MAAM,CAAA,CACb,IAAI,CAAA,QAAA,KAAY;AACf,MAAA,MAAM,eAAA,GACJ,KAAA,CAAM,wBAAA,GAA2B,QAAQ,KAAK,EAAC;AAEjD,MAAA,OAAO;AAAA,QACL,QAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAEH,IAAA,uBACE,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA,EAAY,EAAE,aAAA,EAAe,qBAAA,EAAsB;AAAA,QACnD;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ,CAAC,CAAA,EACH,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultTemplateOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/DefaultTemplateOutputs.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 { InfoCard, MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n ScaffolderOutputText,\n ScaffolderTaskOutput,\n} from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { LinkOutputs } from './LinkOutputs';\nimport { TextOutputs } from './TextOutputs';\n\n/**\n * The DefaultOutputs renderer for the scaffolder task output\n *\n * @alpha\n */\nexport const DefaultTemplateOutputs = (props: {\n output?: ScaffolderTaskOutput;\n}) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { output } = props;\n const [textOutputIndex, setTextOutputIndex] = useState<number | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (textOutputIndex === undefined && output?.text) {\n const defaultIndex = output.text.findIndex(\n (text: ScaffolderOutputText) => text.default,\n );\n setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);\n }\n }, [textOutputIndex, output]);\n\n const textOutput = useMemo(\n () =>\n textOutputIndex !== undefined ? output?.text?.[textOutputIndex] : null,\n [output, textOutputIndex],\n );\n\n if (!output) {\n return null;\n }\n\n const displayTextButtons = (output.text || []).length > 1;\n const emptyOutput = (output.links || []).length === 0 && !displayTextButtons;\n\n return (\n <>\n {!emptyOutput ? (\n <Box paddingBottom={2} data-testid=\"output-box\">\n <Paper>\n <Box\n padding={2}\n justifyContent=\"center\"\n display=\"flex\"\n gridGap={16}\n flexWrap=\"wrap\"\n >\n {displayTextButtons && (\n <TextOutputs\n data-testid=\"text-outputs\"\n output={output}\n index={textOutputIndex}\n setIndex={setTextOutputIndex}\n />\n )}\n <LinkOutputs output={output} />\n </Box>\n </Paper>\n </Box>\n ) : null}\n {textOutput ? (\n <Box paddingBottom={2} data-testid=\"text-output-box\">\n <InfoCard\n title={textOutput.title ?? t('templateOutputs.title')}\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Box padding={2} height=\"100%\">\n <MarkdownContent content={textOutput.content ?? ''} />\n </Box>\n </InfoCard>\n </Box>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAkCO,MAAM,sBAAA,GAAyB,CAAC,KAAA,KAEjC;AACJ,EAAA,MAAM,E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AAA;AAAA,QACf,OAAA,EAAQ,MAAA;AAAA,QACR,OAAA,EAAS,EAAA;AAAA,QACT,QAAA,EAAS,MAAA;AAAA,QAER,QAAA,EAAA;AAAA,UAAA,kBAAA,oBACC,GAAA;AAAA,YAAC,WAAA;AAAA,YAAA;AAAA,cACC,aAAA,EAAY,cAAA;AAAA,cACZ,MAAA;AAAA,cACA,KAAA,EAAO,eAAA;AAAA,cACP,QAAA,EAAU;AAAA;AAAA,WACZ;AAAA,0BAEF,GAAA,CAAC,eAAY,MAAA,EAAgB;AAAA;AAAA;AAAA,KAC/B,EACF,GACF,CAAA,GACE,IAAA;AAAA,IACH,6BACC,GAAA,CAAC,GAAA,EAAA,EAAI,aAAA,EAAe,CAAA,EAAG,eAAY,iBAAA,EACjC,QAAA,kBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA,CAAW,KAAA,IAAS,CAAA,CAAE,uBAAuB,CAAA;AAAA,QACpD,SAAA,EAAS,IAAA;AAAA,QACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAA,EAAK;AAAA,QAExC,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,OAAA,EAAS,CAAA,EAAG,MAAA,EAAO,MAAA,EACtB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,UAAA,CAAW,OAAA,IAAW,EAAA,EAAI,CAAA,EACtD;AAAA;AAAA,OAEJ,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultTemplateOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/DefaultTemplateOutputs.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 { InfoCard, MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n ScaffolderOutputText,\n ScaffolderTaskOutput,\n} from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { LinkOutputs } from './LinkOutputs';\nimport { TextOutputs } from './TextOutputs';\n\n/**\n * The DefaultOutputs renderer for the scaffolder task output\n *\n * @alpha\n */\nexport const DefaultTemplateOutputs = (props: {\n output?: ScaffolderTaskOutput;\n}) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { output } = props;\n const [textOutputIndex, setTextOutputIndex] = useState<number | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (textOutputIndex === undefined && output?.text) {\n const defaultIndex = output.text.findIndex(\n (text: ScaffolderOutputText) => text.default,\n );\n setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);\n }\n }, [textOutputIndex, output]);\n\n const textOutput = useMemo(\n () =>\n textOutputIndex !== undefined ? output?.text?.[textOutputIndex] : null,\n [output, textOutputIndex],\n );\n\n if (!output) {\n return null;\n }\n\n const displayTextButtons = (output.text || []).length > 1;\n const emptyOutput = (output.links || []).length === 0 && !displayTextButtons;\n\n return (\n <>\n {!emptyOutput ? (\n <Box paddingBottom={2} data-testid=\"output-box\">\n <Paper>\n <Box\n padding={2}\n justifyContent=\"center\"\n display=\"flex\"\n gridGap={16}\n flexWrap=\"wrap\"\n >\n {displayTextButtons && (\n <TextOutputs\n data-testid=\"text-outputs\"\n output={output}\n index={textOutputIndex}\n setIndex={setTextOutputIndex}\n />\n )}\n <LinkOutputs output={output} />\n </Box>\n </Paper>\n </Box>\n ) : null}\n {textOutput ? (\n <Box paddingBottom={2} data-testid=\"text-output-box\">\n <InfoCard\n title={textOutput.title ?? t('templateOutputs.title')}\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Box padding={2} height=\"100%\">\n <MarkdownContent content={textOutput.content ?? ''} />\n </Box>\n </InfoCard>\n </Box>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAkCO,MAAM,sBAAA,GAAyB,CAAC,KAAA,KAEjC;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,QAAO,GAAI,KAAA;AACnB,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,eAAA,KAAoB,MAAA,IAAa,MAAA,EAAQ,IAAA,EAAM;AACjD,MAAA,MAAM,YAAA,GAAe,OAAO,IAAA,CAAK,SAAA;AAAA,QAC/B,CAAC,SAA+B,IAAA,CAAK;AAAA,OACvC;AACA,MAAA,kBAAA,CAAmB,YAAA,IAAgB,CAAA,GAAI,YAAA,GAAe,CAAC,CAAA;AAAA,IACzD;AAAA,EACF,CAAA,EAAG,CAAC,eAAA,EAAiB,MAAM,CAAC,CAAA;AAE5B,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MACE,eAAA,KAAoB,MAAA,GAAY,MAAA,EAAQ,IAAA,GAAO,eAAe,CAAA,GAAI,IAAA;AAAA,IACpE,CAAC,QAAQ,eAAe;AAAA,GAC1B;AAEA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,kBAAA,GAAA,CAAsB,MAAA,CAAO,IAAA,IAAQ,IAAI,MAAA,GAAS,CAAA;AACxD,EAAA,MAAM,eAAe,MAAA,CAAO,KAAA,IAAS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EJ,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/LinkOutputs.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 { IconComponent, useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link } from '@backstage/core-components';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nconst useStyles = makeStyles({\n root: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n});\n\nexport const LinkOutputs = (props: { output: ScaffolderTaskOutput }) => {\n const { links = [] } = props.output;\n const classes = useStyles();\n const app = useApp();\n const entityRoute = useRouteRef(entityRouteRef);\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? LinkIcon;\n\n return (\n <>\n {links\n .filter(({ url, entityRef }) => url || entityRef)\n .map(({ url, entityRef, title, icon }) => {\n if (entityRef) {\n const entityName = parseEntityRef(entityRef);\n const target = entityRoute(entityName);\n return { title, icon, url: target };\n }\n return { title, icon, url: url! };\n })\n .map(({ url, title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Link to={url} key={i} classes={{ root: classes.root }}>\n <Button startIcon={<Icon />} component=\"div\" color=\"primary\">\n {title}\n </Button>\n </Link>\n );\n })}\n </>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,CAAC,UAAO,SAAA,kBAAW,GAAA,CAAC,QAAK,CAAA,EAAI,SAAA,EAAU,OAAM,KAAA,EAAM,SAAA,EAChD,QAAA,EAAA,KAAA,EACH,CAAA,EAAA,EAHkB,CAIpB,CAAA;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LinkOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/LinkOutputs.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 { IconComponent, useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link } from '@backstage/core-components';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nconst useStyles = makeStyles({\n root: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n});\n\nexport const LinkOutputs = (props: { output: ScaffolderTaskOutput }) => {\n const { links = [] } = props.output;\n const classes = useStyles();\n const app = useApp();\n const entityRoute = useRouteRef(entityRouteRef);\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? LinkIcon;\n\n return (\n <>\n {links\n .filter(({ url, entityRef }) => url || entityRef)\n .map(({ url, entityRef, title, icon }) => {\n if (entityRef) {\n const entityName = parseEntityRef(entityRef);\n const target = entityRoute(entityName);\n return { title, icon, url: target };\n }\n return { title, icon, url: url! };\n })\n .map(({ url, title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Link to={url} key={i} classes={{ root: classes.root }}>\n <Button startIcon={<Icon />} component=\"div\" color=\"primary\">\n {title}\n </Button>\n </Link>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,SAAA,EAAW;AAAA,MACT,cAAA,EAAgB;AAAA;AAClB;AAEJ,CAAC,CAAA;AAEM,MAAM,WAAA,GAAc,CAAC,KAAA,KAA4C;AACtE,EAAA,MAAM,EAAE,KAAA,GAAQ,EAAC,KAAM,KAAA,CAAM,MAAA;AAC7B,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,MAAM,MAAA,EAAO;AACnB,EAAA,MAAM,WAAA,GAAc,YAAY,cAAc,CAAA;AAE9C,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAA,CAAI,aAAA,CAAc,GAAI,CAAA,IAAK,QAAA;AAE7B,EAAA,uCAEK,QAAA,EAAA,KAAA,CACE,MAAA,CAAO,CAAC,EAAE,GAAA,EAAK,WAAU,KAAM,GAAA,IAAO,SAAS,CAAA,CAC/C,IAAI,CAAC,EAAE,KAAK,SAAA,EAAW,KAAA,EAAO,MAAK,KAAM;AACxC,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAM,UAAA,GAAa,eAAe,SAAS,CAAA;AAC3C,MAAA,MAAM,MAAA,GAAS,YAAY,UAAU,CAAA;AACrC,MAAA,OAAO,EAAE,KAAA,EAAO,IAAA,EAAM,GAAA,EAAK,MAAA,EAAO;AAAA,IACpC;AACA,IAAA,OAAO,EAAE,KAAA,EAAO,IAAA,EAAM,GAAA,EAAU;AAAA,EAClC,CAAC,EACA,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,KAAA,EAAO,IAAA,EAAK,EAAG,CAAA,KAAM;AAChC,IAAA,MAAM,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IAAA,uBACE,GAAA,CAAC,QAAK,EAAA,EAAI,GAAA,EAAa,SAAS,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK,EACnD,QAAA,kBAAA,GAAA,CAAC,UAAO,SAAA,kBAAW,GAAA,CAAC,QAAK,CAAA,EAAI,SAAA,EAAU,OAAM,KAAA,EAAM,SAAA,EAChD,QAAA,EAAA,KAAA,EACH,CAAA,EAAA,EAHkB,CAIpB,CAAA;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/TextOutputs.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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nexport const TextOutputs = (props: {\n output: ScaffolderTaskOutput;\n index?: number;\n setIndex?: (index: number | undefined) => void;\n}) => {\n const {\n output: { text = [] },\n index,\n setIndex,\n } = props;\n\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? DescriptionIcon;\n\n return (\n <>\n {text\n .filter(({ content }) => content !== undefined)\n .map(({ title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Button\n key={i}\n startIcon={<Icon />}\n component=\"div\"\n color=\"primary\"\n onClick={() => {\n if (index !== i) {\n setIndex?.(i);\n }\n }}\n variant={index === i ? 'outlined' : undefined}\n >\n {title}\n </Button>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,WAAA,GAAc,CAAC,KAAA,KAItB;AACJ,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ,EAAE,IAAA,GAAO,EAAC,EAAE;AAAA,IACpB,KAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,MAAM,MAAA,EAAO;AAEnB,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAA,CAAI,aAAA,CAAc,GAAI,CAAA,IAAK,eAAA;AAE7B,EAAA,uCAEK,QAAA,EAAA,IAAA,CACE,MAAA,CAAO,CAAC,EAAE,SAAQ,KAAM,OAAA,KAAY,MAAS,CAAA,CAC7C,IAAI,CAAC,EAAE,KAAA,EAAO,IAAA,IAAQ,CAAA,KAAM;AAC3B,IAAA,MAAM,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IAAA,uBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QAEC,SAAA,sBAAY,IAAA,EAAA,EAAK,CAAA;AAAA,QACjB,SAAA,EAAU,KAAA;AAAA,QACV,KAAA,EAAM,SAAA;AAAA,QACN,SAAS,MAAM;AACb,UAAA,IAAI,UAAU,CAAA,EAAG;AACf,YAAA,QAAA,GAAW,CAAC,CAAA;AAAA,UACd;AAAA,QACF,CAAA;AAAA,QACA,OAAA,EAAS,KAAA,KAAU,CAAA,GAAI,UAAA,GAAa,MAAA;AAAA,QAEnC,QAAA,EAAA;AAAA,OAAA;AAAA,MAXI;AAAA,KAYP;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TextOutputs.esm.js","sources":["../../../../src/next/components/TemplateOutputs/TextOutputs.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 { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport { ScaffolderTaskOutput } from '../../../api';\n\nexport const TextOutputs = (props: {\n output: ScaffolderTaskOutput;\n index?: number;\n setIndex?: (index: number | undefined) => void;\n}) => {\n const {\n output: { text = [] },\n index,\n setIndex,\n } = props;\n\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n app.getSystemIcon(key!) ?? DescriptionIcon;\n\n return (\n <>\n {text\n .filter(({ content }) => content !== undefined)\n .map(({ title, icon }, i) => {\n const Icon = iconResolver(icon);\n return (\n <Button\n key={i}\n startIcon={<Icon />}\n component=\"div\"\n color=\"primary\"\n onClick={() => {\n if (index !== i) {\n setIndex?.(i);\n }\n }}\n variant={index === i ? 'outlined' : undefined}\n >\n {title}\n </Button>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,WAAA,GAAc,CAAC,KAAA,KAItB;AACJ,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ,EAAE,IAAA,GAAO,EAAC,EAAE;AAAA,IACpB,KAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,MAAM,MAAA,EAAO;AAEnB,EAAA,MAAM,eAAe,CAAC,GAAA,KACpB,GAAA,CAAI,aAAA,CAAc,GAAI,CAAA,IAAK,eAAA;AAE7B,EAAA,uCAEK,QAAA,EAAA,IAAA,CACE,MAAA,CAAO,CAAC,EAAE,SAAQ,KAAM,OAAA,KAAY,MAAS,CAAA,CAC7C,IAAI,CAAC,EAAE,KAAA,EAAO,IAAA,IAAQ,CAAA,KAAM;AAC3B,IAAA,MAAM,IAAA,GAAO,aAAa,IAAI,CAAA;AAC9B,IAAA,uBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QAEC,SAAA,sBAAY,IAAA,EAAA,EAAK,CAAA;AAAA,QACjB,SAAA,EAAU,KAAA;AAAA,QACV,KAAA,EAAM,SAAA;AAAA,QACN,SAAS,MAAM;AACb,UAAA,IAAI,UAAU,CAAA,EAAG;AACf,YAAA,QAAA,GAAW,CAAC,CAAA;AAAA,UACd;AAAA,QACF,CAAA;AAAA,QACA,OAAA,EAAS,KAAA,KAAU,CAAA,GAAI,UAAA,GAAa,MAAA;AAAA,QAEnC,QAAA,EAAA;AAAA,OAAA;AAAA,MAXI;AAAA,KAYP;AAAA,EAEJ,CAAC,CAAA,EACL,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.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 { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n InfoCard,\n MarkdownContent,\n Progress,\n} from '@backstage/core-components';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\n\nconst useStyles = makeStyles({\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n marginTop: 0,\n },\n '& :last-child': {\n marginBottom: 0,\n },\n },\n});\n\n/**\n * @alpha\n */\nexport type WorkflowProps = {\n title?: string;\n description?: string;\n namespace: string;\n templateName: string;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n };\n onError(error: Error | undefined): JSX.Element | null;\n} & Pick<\n StepperProps,\n | 'extensions'\n | 'formProps'\n | 'components'\n | 'onCreate'\n | 'initialState'\n | 'layouts'\n>;\n\n/**\n * @alpha\n */\nexport const Workflow = (workflowProps: WorkflowProps): JSX.Element | null => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { title, description, namespace, templateName, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\n const styles = useStyles();\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace: namespace,\n name: templateName,\n });\n\n const errorApi = useApi(errorApiRef);\n\n const { loading, manifest, error } = useTemplateParameterSchema(templateRef);\n\n const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n await onCreate(formState);\n\n analytics.captureEvent('create', 'Task has been created', {\n value: minutesSaved,\n attributes: {\n templateSteps: sortedManifest?.steps?.length ?? 0,\n },\n });\n },\n [onCreate, analytics, minutesSaved, sortedManifest],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(new Error(`Failed to load template, ${error}`));\n }\n }, [error, errorApi]);\n\n if (error) {\n return props.onError(error);\n }\n\n return (\n <Content>\n {loading && <Progress />}\n {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n linkTarget=\"_blank\"\n content={\n description ??\n sortedManifest.description ??\n t('workflow.noDescription')\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\n </InfoCard>\n )}\n </Content>\n );\n};\n\n/**\n * @alpha\n */\nexport const EmbeddableWorkflow = (props: WorkflowProps) => (\n <SecretsContextProvider>\n <Workflow {...props} />\n </SecretsContextProvider>\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,SAAA,EAAW;AAAA,KACb;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,YAAA,EAAc;AAAA;AAChB;AAEJ,CAAC,CAAA;AA2BM,MAAM,QAAA,GAAW,CAAC,aAAA,KAAqD;AAC5E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,OAAO,WAAA,EAAa,SAAA,EAAW,cAAc,QAAA,EAAU,GAAG,OAAM,GACtE,aAAA;AAEF,EAAA,MAAM,YAAY,YAAA,EAAa;AAC/B,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,cAAc,kBAAA,CAAmB;AAAA,IACrC,IAAA,EAAM,UAAA;AAAA,IACN,SAAA;AAAA,IACA,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,KAAA,EAAM,GAAI,2BAA2B,WAAW,CAAA;AAE3E,EAAA,MAAM,cAAA,GAAiB,4BAA4B,QAAQ,CAAA;AAE3D,EAAA,MAAM,YAA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EAAK;AAAA,QAExC,QAAA,kBAAA,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,QAAA,EAAU,cAAA;AAAA,YACV,QAAA,EAAU,gBAAA;AAAA,YACT,GAAG;AAAA;AAAA;AACN;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;AAKO,MAAM,kBAAA,GAAqB,CAAC,KAAA,qBACjC,GAAA,CAAC,0BACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CAAA,EACvB;;;;"}
1
+ {"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.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 { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n InfoCard,\n MarkdownContent,\n Progress,\n} from '@backstage/core-components';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ComponentType, useCallback, useEffect } from 'react';\n\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\n\nconst useStyles = makeStyles({\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n marginTop: 0,\n },\n '& :last-child': {\n marginBottom: 0,\n },\n },\n});\n\n/**\n * @alpha\n */\nexport type WorkflowProps = {\n title?: string;\n description?: string;\n namespace: string;\n templateName: string;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n };\n onError(error: Error | undefined): JSX.Element | null;\n} & Pick<\n StepperProps,\n | 'extensions'\n | 'formProps'\n | 'components'\n | 'onCreate'\n | 'initialState'\n | 'layouts'\n>;\n\n/**\n * @alpha\n */\nexport const Workflow = (workflowProps: WorkflowProps): JSX.Element | null => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { title, description, namespace, templateName, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\n const styles = useStyles();\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace: namespace,\n name: templateName,\n });\n\n const errorApi = useApi(errorApiRef);\n\n const { loading, manifest, error } = useTemplateParameterSchema(templateRef);\n\n const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n await onCreate(formState);\n\n analytics.captureEvent('create', 'Task has been created', {\n value: minutesSaved,\n attributes: {\n templateSteps: sortedManifest?.steps?.length ?? 0,\n },\n });\n },\n [onCreate, analytics, minutesSaved, sortedManifest],\n );\n\n useEffect(() => {\n if (error) {\n errorApi.post(new Error(`Failed to load template, ${error}`));\n }\n }, [error, errorApi]);\n\n if (error) {\n return props.onError(error);\n }\n\n return (\n <Content>\n {loading && <Progress />}\n {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n linkTarget=\"_blank\"\n content={\n description ??\n sortedManifest.description ??\n t('workflow.noDescription')\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\n </InfoCard>\n )}\n </Content>\n );\n};\n\n/**\n * @alpha\n */\nexport const EmbeddableWorkflow = (props: WorkflowProps) => (\n <SecretsContextProvider>\n <Workflow {...props} />\n </SecretsContextProvider>\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,QAAA,EAAU;AAAA;AAAA,IAER,gBAAA,EAAkB;AAAA,MAChB,SAAA,EAAW;AAAA,KACb;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,YAAA,EAAc;AAAA;AAChB;AAEJ,CAAC,CAAA;AA2BM,MAAM,QAAA,GAAW,CAAC,aAAA,KAAqD;AAC5E,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,OAAO,WAAA,EAAa,SAAA,EAAW,cAAc,QAAA,EAAU,GAAG,OAAM,GACtE,aAAA;AAEF,EAAA,MAAM,YAAY,YAAA,EAAa;AAC/B,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,cAAc,kBAAA,CAAmB;AAAA,IACrC,IAAA,EAAM,UAAA;AAAA,IACN,SAAA;AAAA,IACA,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,KAAA,EAAM,GAAI,2BAA2B,WAAW,CAAA;AAE3E,EAAA,MAAM,cAAA,GAAiB,4BAA4B,QAAQ,CAAA;AAE3D,EAAA,MAAM,YAAA,GAAe,4BAA4B,WAAW,CAAA;AAE5D,EAAA,MAAM,gBAAA,GAAmB,WAAA;AAAA,IACvB,OAAO,SAAA,KAAyC;AAC9C,MAAA,MAAM,SAAS,SAAS,CAAA;AAExB,MAAA,SAAA,CAAU,YAAA,CAAa,U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A,EAEJ,CAAA;AAEJ;AAKO,MAAM,kBAAA,GAAqB,CAAC,KAAA,qBACjC,GAAA,CAAC,0BACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CAAA,EACvB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffolderFormDecorator.esm.js","sources":["../../../src/next/extensions/createScaffolderFormDecorator.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 */\nimport { AnyApiRef } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { z } from 'zod/v3';\n\n/** @alpha */\nexport type ScaffolderFormDecoratorContext<\n TInput extends JsonObject = JsonObject,\n> = {\n input: TInput;\n formState: Record<string, JsonValue>;\n\n setFormState: (\n fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,\n ) => void;\n setSecrets: (\n fn: (currentState: Record<string, string>) => Record<string, string>,\n ) => void;\n};\n\n/** @public */\nexport type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {\n readonly $$type: '@backstage/scaffolder/FormDecorator';\n readonly id: string;\n readonly TInput: TInput;\n};\n\n/**\n * Method for creating decorators which can be used to collect\n * secrets from the user before submitting to the backend.\n * @alpha\n */\nexport function createScaffolderFormDecorator<\n TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },\n TInput extends JsonObject = {\n [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;\n },\n>(options: {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext<TInput>,\n deps: TDeps extends { [key in string]: AnyApiRef }\n ? { [key in keyof TDeps]: TDeps[key]['T'] }\n : never,\n ) => Promise<void>;\n}): ScaffolderFormDecorator<TInput> {\n return OpaqueFormDecorator.createInstance('v1', {\n ...options,\n TInput: null as unknown as TInput,\n } as {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n TInput: TInput;\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [key in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n });\n}\n"],"names":[],"mappings":";;;AA+CO,SAAS,8BAQd,OAAA,EAYkC;AAClC,EAAA,OAAO,mBAAA,CAAoB,eAAe,IAAA,EAAM;AAAA,IAC9C,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ;AAAA,GAYT,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"createScaffolderFormDecorator.esm.js","sources":["../../../src/next/extensions/createScaffolderFormDecorator.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 */\nimport { AnyApiRef } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { OpaqueFormDecorator } from '@internal/scaffolder';\nimport { z } from 'zod/v3';\n\n/** @alpha */\nexport type ScaffolderFormDecoratorContext<\n TInput extends JsonObject = JsonObject,\n> = {\n input: TInput;\n formState: Record<string, JsonValue>;\n\n setFormState: (\n fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,\n ) => void;\n setSecrets: (\n fn: (currentState: Record<string, string>) => Record<string, string>,\n ) => void;\n};\n\n/** @public */\nexport type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {\n readonly $$type: '@backstage/scaffolder/FormDecorator';\n readonly id: string;\n readonly TInput: TInput;\n};\n\n/**\n * Method for creating decorators which can be used to collect\n * secrets from the user before submitting to the backend.\n * @alpha\n */\nexport function createScaffolderFormDecorator<\n TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },\n TInput extends JsonObject = {\n [key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;\n },\n>(options: {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext<TInput>,\n deps: TDeps extends { [key in string]: AnyApiRef }\n ? { [key in keyof TDeps]: TDeps[key]['T'] }\n : never,\n ) => Promise<void>;\n}): ScaffolderFormDecorator<TInput> {\n return OpaqueFormDecorator.createInstance('v1', {\n ...options,\n TInput: null as unknown as TInput,\n } as {\n id: string;\n schema?: {\n input?: TInputSchema;\n };\n TInput: TInput;\n deps?: TDeps;\n decorator: (\n ctx: ScaffolderFormDecoratorContext,\n deps: { [key in string]: AnyApiRef['T'] },\n ) => Promise<void>;\n });\n}\n"],"names":[],"mappings":";;;AA+CO,SAAS,8BAQd,OAAA,EAYkC;AAClC,EAAA,OAAO,mBAAA,CAAoB,eAAe,IAAA,EAAM;AAAA,IAC9C,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ;AAAA,GAYT,CAAA;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDownloadLogs.esm.js","sources":["../../../src/next/hooks/useDownloadLogs.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { useCallback } from 'react';\nimport { useParams } from 'react-router';\n\nexport const useDownloadLogs = (logs: { [k: string]: string[] }) => {\n const { taskId } = useParams<{ taskId: string }>();\n return useCallback(() => {\n const element = document.createElement('a');\n const file = new Blob(\n [\n Object.values(logs)\n .map(l => l.join('\\n'))\n .filter(Boolean)\n .join('\\n'),\n ],\n { type: 'text/plain' },\n );\n element.href = URL.createObjectURL(file);\n element.download = `${taskId}.log`;\n element.click();\n URL.revokeObjectURL(element.href);\n element.remove();\n }, [logs, taskId]);\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,eAAA,GAAkB,CAAC,IAAA,KAAoC;AAClE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAA8B;AACjD,EAAA,OAAO,YAAY,MAAM;AACvB,IAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,GAAG,CAAA;AAC1C,IAAA,MAAM,OAAO,IAAI,IAAA;AAAA,MACf;AAAA,QACE,MAAA,CAAO,MAAA,CAAO,IAAI,CAAA,CACf,IAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CACrB,MAAA,CAAO,OAAO,CAAA,CACd,KAAK,IAAI;AAAA,OACd;AAAA,MACA,EAAE,MAAM,YAAA;AAAa,KACvB;AACA,IAAA,OAAA,CAAQ,IAAA,GAAO,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAA;AACvC,IAAA,OAAA,CAAQ,QAAA,GAAW,GAAG,MAAM,CAAA,IAAA,CAAA;AAC5B,IAAA,OAAA,CAAQ,KAAA,EAAM;AACd,IAAA,GAAA,CAAI,eAAA,CAAgB,QAAQ,IAAI,CAAA;AAChC,IAAA,OAAA,CAAQ,MAAA,EAAO;AAAA,EACjB,CAAA,EAAG,CAAC,IAAA,EAAM,MAAM,CAAC,CAAA;AACnB;;;;"}
1
+ {"version":3,"file":"useDownloadLogs.esm.js","sources":["../../../src/next/hooks/useDownloadLogs.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { useCallback } from 'react';\nimport { useParams } from 'react-router';\n\nexport const useDownloadLogs = (logs: { [k: string]: string[] }) => {\n const { taskId } = useParams<{ taskId: string }>();\n return useCallback(() => {\n const element = document.createElement('a');\n const file = new Blob(\n [\n Object.values(logs)\n .map(l => l.join('\\n'))\n .filter(Boolean)\n .join('\\n'),\n ],\n { type: 'text/plain' },\n );\n element.href = URL.createObjectURL(file);\n element.download = `${taskId}.log`;\n element.click();\n URL.revokeObjectURL(element.href);\n element.remove();\n }, [logs, taskId]);\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,eAAA,GAAkB,CAAC,IAAA,KAAoC;AAClE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAA8B;AACjD,EAAA,OAAO,YAAY,MAAM;AACvB,IAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,GAAG,CAAA;AAC1C,IAAA,MAAM,OAAO,IAAI,IAAA;AAAA,MACf;AAAA,QACE,MAAA,CAAO,MAAA,CAAO,IAAI,CAAA,CACf,IAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CACrB,MAAA,CAAO,OAAO,CAAA,CACd,KAAK,IAAI;AAAA,OACd;AAAA,MACA,EAAE,MAAM,YAAA;AAAa,KACvB;AACA,IAAA,OAAA,CAAQ,IAAA,GAAO,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAA;AACvC,IAAA,OAAA,CAAQ,QAAA,GAAW,GAAG,MAAM,CAAA,IAAA,CAAA;AAC5B,IAAA,OAAA,CAAQ,KAAA,EAAM;AACd,IAAA,GAAA,CAAI,eAAA,CAAgB,QAAQ,IAAI,CAAA;AAChC,IAAA,OAAA,CAAQ,MAAA,EAAO;AAAA,EACjB,CAAA,EAAG,CAAC,IAAA,EAAM,MAAM,CAAC,CAAA;AACnB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFilteredSchemaProperties.esm.js","sources":["../../../src/next/hooks/useFilteredSchemaProperties.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 cloneDeep from 'lodash/cloneDeep';\nimport { useApi, featureFlagsApiRef } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { useMemo } from 'react';\n\n/**\n * Returns manifest of software templates with steps without a featureFlag tag.\n * @alpha\n */\n\nexport const useFilteredSchemaProperties = (\n manifest: TemplateParameterSchema | undefined,\n): TemplateParameterSchema | undefined => {\n const featureFlagKey = 'backstage:featureFlag';\n const featureFlagApi = useApi(featureFlagsApiRef);\n\n return useMemo(() => {\n if (!manifest) {\n return undefined;\n }\n const filteredSteps = manifest?.steps\n .filter(step => {\n const featureFlag = step.schema[featureFlagKey];\n return (\n typeof featureFlag !== 'string' ||\n featureFlagApi.isActive(featureFlag)\n );\n })\n .map(step => {\n const filteredStep = cloneDeep(step);\n const removedPropertyKeys: Array<string> = [];\n if (filteredStep.schema.properties) {\n filteredStep.schema.properties = Object.fromEntries(\n Object.entries(filteredStep.schema.properties).filter(\n ([key, value]) => {\n if (value[featureFlagKey]) {\n if (featureFlagApi.isActive(value[featureFlagKey])) {\n return true;\n }\n\n removedPropertyKeys.push(key);\n return false;\n }\n return true;\n },\n ),\n );\n\n // remove the feature flag property key from required if they are not active\n filteredStep.schema.required = Array.isArray(\n filteredStep.schema.required,\n )\n ? filteredStep.schema.required?.filter(\n r => !removedPropertyKeys.includes(r as string),\n )\n : filteredStep.schema.required;\n }\n\n return filteredStep;\n });\n\n return { ...manifest, steps: filteredSteps };\n }, [manifest, featureFlagApi]);\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,2BAAA,GAA8B,CACzC,QAAA,KACwC;AACxC,EAAA,MAAM,cAAA,GAAiB,uBAAA;AACvB,EAAA,MAAM,cAAA,GAAiB,OAAO,kBAAkB,CAAA;AAEhD,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAA,IAAI,CAAC,QAAA,EAAU;AACb,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,MAAM,aAAA,GAAgB,QAAA,EAAU,KAAA,CAC7B,MAAA,CAAO,CAAA,IAAA,KAAQ;AACd,MAAA,MAAM,WAAA,GAAc,IAAA,CAAK,MAAA,CAAO,cAAc,CAAA;AAC9C,MAAA,OACE,OAAO,WAAA,KAAgB,QAAA,IACvB,cAAA,CAAe,SAAS,WAAW,CAAA;AAAA,IAEvC,CAAC,CAAA,CACA,GAAA,CAAI,CAAA,IAAA,KAAQ;AACX,MAAA,MAAM,YAAA,GAAe,UAAU,IAAI,CAAA;AACnC,MAAA,MAAM,sBAAqC,EAAC;AAC5C,MAAA,IAAI,YAAA,CAAa,OAAO,UAAA,EAAY;AAClC,QAAA,YAAA,CAAa,MAAA,CAAO,aAAa,MAAA,CAAO,WAAA;AAAA,UACtC,MAAA,CAAO,OAAA,CAAQ,YAAA,CAAa,MAAA,CAAO,UAAU,CAAA,CAAE,MAAA;AAAA,YAC7C,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM;AAChB,cAAA,IAAI,KAAA,CAAM,cAAc,CAAA,EAAG;AACzB,gBAAA,IAAI,cAAA,CAAe,QAAA,CAAS,KAAA,CAAM,cAAc,CAAC,CAAA,EAAG;AAClD,kBAAA,OAAO,IAAA;AAAA,gBACT;AAEA,gBAAA,mBAAA,CAAoB,KAAK,GAAG,CAAA;AAC5B,gBAAA,OAAO,KAAA;AAAA,cACT;AACA,cAAA,OAAO,IAAA;AAAA,YACT;AAAA;AACF,SACF;AAGA,QAAA,YAAA,CAAa,MAAA,CAAO,WAAW,KAAA,CAAM,OAAA;AAAA,UACnC,aAAa,MAAA,CAAO;AAAA,SACtB,GACI,YAAA,CAAa,MAAA,CAAO,QAAA,EAAU,MAAA;AAAA,UAC5B,CAAA,CAAA,KAAK,CAAC,mBAAA,CAAoB,QAAA,CAAS,CAAW;AAAA,SAChD,GACA,aAAa,MAAA,CAAO,QAAA;AAAA,MAC1B;AAEA,MAAA,OAAO,YAAA;AAAA,IACT,CAAC,CAAA;AAEH,IAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAO,aAAA,EAAc;AAAA,EAC7C,CAAA,EAAG,CAAC,QAAA,EAAU,cAAc,CAAC,CAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"useFilteredSchemaProperties.esm.js","sources":["../../../src/next/hooks/useFilteredSchemaProperties.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 cloneDeep from 'lodash/cloneDeep';\nimport { useApi, featureFlagsApiRef } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { useMemo } from 'react';\n\n/**\n * Returns manifest of software templates with steps without a featureFlag tag.\n * @alpha\n */\n\nexport const useFilteredSchemaProperties = (\n manifest: TemplateParameterSchema | undefined,\n): TemplateParameterSchema | undefined => {\n const featureFlagKey = 'backstage:featureFlag';\n const featureFlagApi = useApi(featureFlagsApiRef);\n\n return useMemo(() => {\n if (!manifest) {\n return undefined;\n }\n const filteredSteps = manifest?.steps\n .filter(step => {\n const featureFlag = step.schema[featureFlagKey];\n return (\n typeof featureFlag !== 'string' ||\n featureFlagApi.isActive(featureFlag)\n );\n })\n .map(step => {\n const filteredStep = cloneDeep(step);\n const removedPropertyKeys: Array<string> = [];\n if (filteredStep.schema.properties) {\n filteredStep.schema.properties = Object.fromEntries(\n Object.entries(filteredStep.schema.properties).filter(\n ([key, value]) => {\n if (value[featureFlagKey]) {\n if (featureFlagApi.isActive(value[featureFlagKey])) {\n return true;\n }\n\n removedPropertyKeys.push(key);\n return false;\n }\n return true;\n },\n ),\n );\n\n // remove the feature flag property key from required if they are not active\n filteredStep.schema.required = Array.isArray(\n filteredStep.schema.required,\n )\n ? filteredStep.schema.required?.filter(\n r => !removedPropertyKeys.includes(r as string),\n )\n : filteredStep.schema.required;\n }\n\n return filteredStep;\n });\n\n return { ...manifest, steps: filteredSteps };\n }, [manifest, featureFlagApi]);\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,2BAAA,GAA8B,CACzC,QAAA,KACwC;AACxC,EAAA,MAAM,cAAA,GAAiB,uBAAA;AACvB,EAAA,MAAM,cAAA,GAAiB,OAAO,kBAAkB,CAAA;AAEhD,EAAA,OAAO,Q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GACA,aAAa,MAAA,CAAO,QAAA;AAAA,MAC1B;AAEA,MAAA,OAAO,YAAA;AAAA,IACT,CAAC,CAAA;AAEH,IAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAO,aAAA,EAAc;AAAA,EAC7C,CAAA,EAAG,CAAC,QAAA,EAAU,cAAc,CAAC,CAAA;AAC/B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFormDataFromQuery.esm.js","sources":["../../../src/next/hooks/useFormDataFromQuery.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 { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n"],"names":[],"mappings":";;;AAwBO,MAAM,oBAAA,GAAuB,CAClC,YAAA,KACG;AACH,EAAA,OAAO,SAA8B,MAAM;AACzC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,OAAO,YAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA,GAAQ,EAAA,CAAG,KAAA,CAAM,MAAA,CAAO,SAAS,MAAA,EAAQ;AAAA,MAC7C,iBAAA,EAAmB;AAAA,KACpB,CAAA;AAED,IAAA,IAAI;AACF,MAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,QAAkB,CAAA;AAAA,IAC5C,SAAS,CAAA,EAAG;AACV,MAAA,OAAO,EAAC;AAAA,IACV;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useFormDataFromQuery.esm.js","sources":["../../../src/next/hooks/useFormDataFromQuery.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 { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n"],"names":[],"mappings":";;;AAwBO,MAAM,oBAAA,GAAuB,CAClC,YAAA,KACG;AACH,EAAA,OAAO,SAA8B,MAAM;AACzC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,OAAO,YAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA,GAAQ,EAAA,CAAG,KAAA,CAAM,MAAA,CAAO,SAAS,MAAA,EAAQ;AAAA,MAC7C,iBAAA,EAAmB;AAAA,KACpB,CAAA;AAED,IAAA,IAAI;AACF,MAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,QAAkB,CAAA;AAAA,IAC5C,SAAS,CAAA,EAAG;AACV,MAAA,OAAO,EAAC;AAAA,IACV;AAAA,EACF,CAAC,CAAA;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.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 useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (\n templateRef: string,\n): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const {\n value: manifest,\n loading,\n error,\n } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,0BAAA,GAA6B,CACxC,WAAA,KAC4E;AAC5E,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAA;AAAA,IACF,MAAM,aAAA,CAAc,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useTemplateParameterSchema.esm.js","sources":["../../../src/next/hooks/useTemplateParameterSchema.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 useAsync from 'react-use/esm/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (\n templateRef: string,\n): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const {\n value: manifest,\n loading,\n error,\n } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return {\n manifest,\n loading,\n error,\n };\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,0BAAA,GAA6B,CACxC,WAAA,KAC4E;AAC5E,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAA;AAAA,IACF,MAAM,aAAA,CAAc,0BAAA,CAA2B,WAAW,CAAA;AAAA,IAC1D,CAAC,eAAe,WAAW;AAAA,GAC7B;AAEA,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.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 */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n const { title, ...stepSchema } = step.schema;\n\n const strippedSchema = {\n ...step,\n schema: {\n ...stepSchema,\n },\n } as ParsedTemplateSchema;\n\n if (step.schema?.properties || !step.schema?.dependencies) {\n strippedSchema.schema.properties = Object.fromEntries(\n Object.entries((step.schema?.properties ?? {}) as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n );\n }\n\n return strippedSchema;\n });\n\n return {\n presentation: manifest.presentation,\n steps: returningSteps,\n };\n};\n"],"names":[],"mappings":";;;AAwCO,MAAM,iBAAA,GAAoB,CAC/B,QAAA,KAIG;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,kBAAkB,CAAA;AAC9C,EAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,MAAA,EAAO,MAAO;AAAA,IACpE,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA,EAAc,MAAA;AAAA,IACd,GAAG,sBAAsB,MAAM;AAAA,GACjC,CAAE,CAAA;AAEF,EAAA,MAAM,cAAA,GAAiB,KAAA,CAEpB,MAAA,CAAO,CAAA,IAAA,KAAQ;AACd,IAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,QAAA,CAAS,cAAc,CAAA,EAAG,WAAA;AACvD,IAAA,OAAO,eAAA,GAAkB,YAAA,CAAa,QAAA,CAAS,eAAe,CAAA,GAAI,IAAA;AAAA,EACpE,CAAC,CAAA,CAEA,GAAA,CAAI,CAAA,IAAA,KAAQ;AAEX,IAAA,MAAM,EAAE,KAAA,EAAO,GAAG,UAAA,KAAe,IAAA,CAAK,MAAA;AAEtC,IAAA,MAAM,cAAA,GAAiB;AAAA,MACrB,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ;AAAA,QACN,GAAG;AAAA;AACL,KACF;AAEA,IAAA,IAAI,KAAK,MAAA,EAAQ,UAAA,IAAc,CAAC,IAAA,CAAK,QAAQ,YAAA,EAAc;AACzD,MAAA,cAAA,CAAe,MAAA,CAAO,aAAa,MAAA,CAAO,WAAA;AAAA,QACxC,OAAO,OAAA,CAAS,IAAA,CAAK,QAAQ,UAAA,IAAc,EAAiB,CAAA,CAAE,MAAA;AAAA,UAC5D,CAAC,CAAC,GAAG,CAAA,KAAM;AACT,YAAA,MAAM,kBACJ,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,cAAc,CAAA,EAAG,WAAA;AACxC,YAAA,OAAO,eAAA,GACH,YAAA,CAAa,QAAA,CAAS,eAAe,CAAA,GACrC,IAAA;AAAA,UACN;AAAA;AACF,OACF;AAAA,IACF;AAEA,IAAA,OAAO,cAAA;AAAA,EACT,CAAC,CAAA;AAEH,EAAA,OAAO;AAAA,IACL,cAAc,QAAA,CAAS,YAAA;AAAA,IACvB,KAAA,EAAO;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"useTemplateSchema.esm.js","sources":["../../../src/next/hooks/useTemplateSchema.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 */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): {\n steps: ParsedTemplateSchema[];\n presentation?: TemplatePresentationV1beta3;\n} => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => {\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n const { title, ...stepSchema } = step.schema;\n\n const strippedSchema = {\n ...step,\n schema: {\n ...stepSchema,\n },\n } as ParsedTemplateSchema;\n\n if (step.schema?.properties || !step.schema?.dependencies) {\n strippedSchema.schema.properties = Object.fromEntries(\n Object.entries((step.schema?.properties ?? {}) as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n );\n }\n\n return strippedSchema;\n });\n\n return {\n presentation: manifest.presentation,\n steps: returningSteps,\n };\n};\n"],"names":[],"mappings":";;;AAwCO,MAAM,iBAAA,GAAoB,CAC/B,QAAA,KAIG;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,kBAAkB,CAAA;AAC9C,EAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,MAAA,EAAO,MAAO;AAAA,IACpE,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA,EAAc,MAAA;AAAA,IACd,GAAG,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"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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Duration } from 'luxon';\nimport useAsync from 'react-use/lib/useAsync';\n\n/**\n * Returns the backstage.io/time-saved annotation (as a number of minutes) for\n * a given template entity ref.\n */\nexport const useTemplateTimeSavedMinutes = (templateRef: string) => {\n const catalogApi = useApi(catalogApiRef);\n\n const { value: timeSavedMinutes } = useAsync(async () => {\n const entity = await catalogApi.getEntityByRef(templateRef);\n const timeSaved = entity?.metadata.annotations?.['backstage.io/time-saved'];\n\n // This is not a valid template or the template has no time-saved value.\n if (!entity || !timeSaved) {\n return undefined;\n }\n\n const durationMs = Duration.fromISO(timeSaved).as('minutes');\n\n // The time-saved annotation has an invalid value. Ignore.\n if (Number.isNaN(durationMs)) {\n return undefined;\n }\n\n return durationMs;\n }, [catalogApi, templateRef]);\n\n return timeSavedMinutes;\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,2BAAA,GAA8B,CAAC,WAAA,KAAwB;AAClE,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAA,EAAiB,GAAI,SAAS,YAAY;AACvD,IAAA,MAAM,MAAA,GAAS,MAAM,UAAA,CAAW,cAAA,CAAe,WAAW,CAAA;AAC1D,IAAA,MAAM,SAAA,GAAY,MAAA,EAAQ,QAAA,CAAS,WAAA,GAAc,yBAAyB,CAAA;AAG1E,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,SAAA,EAAW;AACzB,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,aAAa,QAAA,CAAS,OAAA,CAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAA;AAG3D,IAAA,IAAI,MAAA,CAAO,KAAA,CAAM,UAAU,CAAA,EAAG;AAC5B,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,CAAA,EAAG,CAAC,UAAA,EAAY,WAAW,CAAC,CAAA;AAE5B,EAAA,OAAO,gBAAA;AACT;;;;"}
1
+ {"version":3,"file":"useTemplateTimeSaved.esm.js","sources":["../../../src/next/hooks/useTemplateTimeSaved.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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Duration } from 'luxon';\nimport useAsync from 'react-use/lib/useAsync';\n\n/**\n * Returns the backstage.io/time-saved annotation (as a number of minutes) for\n * a given template entity ref.\n */\nexport const useTemplateTimeSavedMinutes = (templateRef: string) => {\n const catalogApi = useApi(catalogApiRef);\n\n const { value: timeSavedMinutes } = useAsync(async () => {\n const entity = await catalogApi.getEntityByRef(templateRef);\n const timeSaved = entity?.metadata.annotations?.['backstage.io/time-saved'];\n\n // This is not a valid template or the template has no time-saved value.\n if (!entity || !timeSaved) {\n return undefined;\n }\n\n const durationMs = Duration.fromISO(timeSaved).as('minutes');\n\n // The time-saved annotation has an invalid value. Ignore.\n if (Number.isNaN(durationMs)) {\n return undefined;\n }\n\n return durationMs;\n }, [catalogApi, templateRef]);\n\n return timeSavedMinutes;\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,2BAAA,GAA8B,CAAC,WAAA,KAAwB;AAClE,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAA,EAAiB,GAAI,SAAS,YAAY;AACvD,IAAA,MAAM,MAAA,GAAS,MAAM,UAAA,CAAW,cAAA,CAAe,WAAW,CAAA;AAC1D,IAAA,MAAM,SAAA,GAAY,MAAA,EAAQ,QAAA,CAAS,WAAA,GAAc,yBAAyB,CAAA;AAG1E,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,SAAA,EAAW;AACzB,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,aAAa,QAAA,CAAS,OAAA,CAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAA;AAG3D,IAAA,IAAI,MAAA,CAAO,KAAA,CAAM,UAAU,CAAA,EAAG;AAC5B,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,CAAA,EAAG,CAAC,UAAA,EAAY,WAAW,CAAC,CAAA;AAE5B,EAAA,OAAO,gBAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTransformSchemaToProps.esm.js","sources":["../../../src/next/hooks/useTransformSchemaToProps.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 { useMemo } from 'react';\nimport { LayoutOptions } from '../../layouts';\nimport { type ParsedTemplateSchema } from './useTemplateSchema';\n\ninterface Options {\n layouts?: LayoutOptions[];\n}\n\nexport const useTransformSchemaToProps = (\n step: ParsedTemplateSchema,\n options: Options = {},\n): ParsedTemplateSchema => {\n const { layouts = [] } = options;\n const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as\n | string\n | undefined;\n return useMemo(() => {\n if (typeof objectFieldTemplate !== 'string') {\n return step;\n }\n\n const Layout = layouts.find(\n layout => layout.name === objectFieldTemplate,\n )?.component;\n\n if (!Layout) {\n return step;\n }\n return {\n ...step,\n uiSchema: {\n ...step.uiSchema,\n ['ui:ObjectFieldTemplate']: Layout,\n },\n };\n }, [layouts, objectFieldTemplate, step]);\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAAA,GAA4B,CACvC,IAAA,EACA,OAAA,GAAmB,EAAC,KACK;AACzB,EAAA,MAAM,EAAE,OAAA,GAAU,EAAC,EAAE,GAAI,OAAA;AACzB,EAAA,MAAM,mBAAA,GAAsB,IAAA,EAAM,QAAA,CAAS,wBAAwB,CAAA;AAGnE,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAA,IAAI,OAAO,wBAAwB,QAAA,EAAU;AAC3C,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,SAAS,OAAA,CAAQ,IAAA;AAAA,MACrB,CAAA,MAAA,KAAU,OAAO,IAAA,KAAS;AAAA,KAC5B,EAAG,SAAA;AAEH,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAO;AAAA,MACL,GAAG,IAAA;AAAA,MACH,QAAA,EAAU;AAAA,QACR,GAAG,IAAA,CAAK,QAAA;AAAA,QACR,CAAC,wBAAwB,GAAG;AAAA;AAC9B,KACF;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,mBAAA,EAAqB,IAAI,CAAC,CAAA;AACzC;;;;"}
1
+ {"version":3,"file":"useTransformSchemaToProps.esm.js","sources":["../../../src/next/hooks/useTransformSchemaToProps.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 { useMemo } from 'react';\nimport { LayoutOptions } from '../../layouts';\nimport { type ParsedTemplateSchema } from './useTemplateSchema';\n\ninterface Options {\n layouts?: LayoutOptions[];\n}\n\nexport const useTransformSchemaToProps = (\n step: ParsedTemplateSchema,\n options: Options = {},\n): ParsedTemplateSchema => {\n const { layouts = [] } = options;\n const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as\n | string\n | undefined;\n return useMemo(() => {\n if (typeof objectFieldTemplate !== 'string') {\n return step;\n }\n\n const Layout = layouts.find(\n layout => layout.name === objectFieldTemplate,\n )?.component;\n\n if (!Layout) {\n return step;\n }\n return {\n ...step,\n uiSchema: {\n ...step.uiSchema,\n ['ui:ObjectFieldTemplate']: Layout,\n },\n };\n }, [layouts, objectFieldTemplate, step]);\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAAA,GAA4B,CACvC,IAAA,EACA,OAAA,GAAmB,EAAC,KACK;AACzB,EAAA,MAAM,EAAE,OAAA,GAAU,EAAC,EAAE,GAAI,OAAA;AACzB,EAAA,MAAM,mBAAA,GAAsB,IAAA,EAAM,QAAA,CAAS,wBAAwB,CAAA;AAGnE,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAA,IAAI,OAAO,wBAAwB,QAAA,EAAU;AAC3C,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,SAAS,OAAA,CAAQ,IAAA;AAAA,MACrB,CAAA,MAAA,KAAU,OAAO,IAAA,KAAS;AAAA,KAC5B,EAAG,SAAA;AAEH,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAO;AAAA,MACL,GAAG,IAAA;AAAA,MACH,QAAA,EAAU;AAAA,QACR,GAAG,IAAA,CAAK,QAAA;AAAA,QACR,CAAC,wBAAwB,GAAG;AAAA;AAC9B,KACF;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,mBAAA,EAAqB,IAAI,CAAC,CAAA;AACzC;;"}